• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nats-io / nats-server / 16514080193

24 Jul 2025 02:40PM UTC coverage: 85.848% (+0.2%) from 85.69%
16514080193

push

github

web-flow
(2.12) Filestore async flush (#7018)

The filestore's `AsyncFlush` setting can now be enabled for a JetStream
stream using the `AllowAsyncFlush` field. Some initial benchmarks showed
a 10-15% performance increase when using a R3 stream (3-node cluster
with each node in a different availability zone).

Only enabling the filestore's `AsyncFlush` setting without additional
code would be unsafe. That's why this PR introduces some new mechanisms
to make it safe. This makes the performance improvement essentially
"free", with no negative consequences for data safety/consistency.
- Before `n.InstallSnapshot(..)` we now do a `mset.flushAllPending()` to
ensure all state represented in the snapshot, actually all made it to
disk.
- The previous `fs.lmb` would only be sometimes be flushed, for example
in `fs.checkLastBlock` but not when creating a new `fs.lmb` in
`fs.newMsgBlockForWrite`. Instead, always flush and close `fs.lmb` when
creating a new block in `fs.newMsgBlockForWrite`. This resolves
non-monotonic sequence issues that could be reproduced by Antithesis.
- The `AllowAsyncFlush` stream setting can be freely/safely enabled and
disabled. It will only be effective when using file storage, and only
when the stream is backed by a Raft log, i.e. it's replicated.

Relates to https://github.com/nats-io/nats-server/issues/6784

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>

71266 of 83014 relevant lines covered (85.85%)

374223.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.29
/server/jetstream_errors_generated.go
1
// Generated code, do not edit. See errors.json and run go generate to update
2

3
package server
4

5
import "strings"
6

7
const (
8
        // JSAccountResourcesExceededErr resource limits exceeded for account
9
        JSAccountResourcesExceededErr ErrorIdentifier = 10002
10

11
        // JSAtomicPublishDisabledErr atomic publish is disabled
12
        JSAtomicPublishDisabledErr ErrorIdentifier = 10174
13

14
        // JSAtomicPublishIncompleteBatchErr atomic publish batch is incomplete
15
        JSAtomicPublishIncompleteBatchErr ErrorIdentifier = 10176
16

17
        // JSAtomicPublishMissingSeqErr atomic publish sequence is missing
18
        JSAtomicPublishMissingSeqErr ErrorIdentifier = 10175
19

20
        // JSAtomicPublishUnsupportedHeaderBatchErr atomic publish unsupported header used: {header}
21
        JSAtomicPublishUnsupportedHeaderBatchErr ErrorIdentifier = 10177
22

23
        // JSBadRequestErr bad request
24
        JSBadRequestErr ErrorIdentifier = 10003
25

26
        // JSClusterIncompleteErr incomplete results
27
        JSClusterIncompleteErr ErrorIdentifier = 10004
28

29
        // JSClusterNoPeersErrF Error causing no peers to be available ({err})
30
        JSClusterNoPeersErrF ErrorIdentifier = 10005
31

32
        // JSClusterNotActiveErr JetStream not in clustered mode
33
        JSClusterNotActiveErr ErrorIdentifier = 10006
34

35
        // JSClusterNotAssignedErr JetStream cluster not assigned to this server
36
        JSClusterNotAssignedErr ErrorIdentifier = 10007
37

38
        // JSClusterNotAvailErr JetStream system temporarily unavailable
39
        JSClusterNotAvailErr ErrorIdentifier = 10008
40

41
        // JSClusterNotLeaderErr JetStream cluster can not handle request
42
        JSClusterNotLeaderErr ErrorIdentifier = 10009
43

44
        // JSClusterPeerNotMemberErr peer not a member
45
        JSClusterPeerNotMemberErr ErrorIdentifier = 10040
46

47
        // JSClusterRequiredErr JetStream clustering support required
48
        JSClusterRequiredErr ErrorIdentifier = 10010
49

50
        // JSClusterServerNotMemberErr server is not a member of the cluster
51
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
52

53
        // JSClusterTagsErr tags placement not supported for operation
54
        JSClusterTagsErr ErrorIdentifier = 10011
55

56
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
57
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
58

59
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
60
        JSConsumerAlreadyExists ErrorIdentifier = 10148
61

62
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
63
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
64

65
        // JSConsumerConfigRequiredErr consumer config required
66
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
67

68
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
69
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
70

71
        // JSConsumerCreateErrF General consumer creation failure string ({err})
72
        JSConsumerCreateErrF ErrorIdentifier = 10012
73

74
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
75
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
76

77
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
78
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
79

80
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
81
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
82

83
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
84
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
85

86
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
87
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
88

89
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
90
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
91

92
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
93
        JSConsumerDoesNotExist ErrorIdentifier = 10149
94

95
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
96
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
97

98
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
99
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
100

101
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
102
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
103

104
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
105
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
106

107
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
108
        JSConsumerEmptyFilter ErrorIdentifier = 10139
109

110
        // JSConsumerEmptyGroupName Group name cannot be an empty string
111
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
112

113
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
114
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
115

116
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
117
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
118

119
        // JSConsumerExistingActiveErr consumer already exists and is still active
120
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
121

122
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
123
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
124

125
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
126
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
127

128
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
129
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
130

131
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
132
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
133

134
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
135
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
136

137
        // JSConsumerInvalidGroupNameErr Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters
138
        JSConsumerInvalidGroupNameErr ErrorIdentifier = 10162
139

140
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
141
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
142

143
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
144
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
145

146
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
147
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
148

149
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
150
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
151

152
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
153
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
154

155
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
156
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
157

158
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
159
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
160

161
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
162
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
163

164
        // JSConsumerMaxRequestExpiresToSmall consumer max request expires needs to be >= 1ms
165
        JSConsumerMaxRequestExpiresToSmall ErrorIdentifier = 10115
166

167
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
168
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
169

170
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
171
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
172

173
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
174
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
175

176
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
177
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
178

179
        // JSConsumerNameExistErr consumer name already in use
180
        JSConsumerNameExistErr ErrorIdentifier = 10013
181

182
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
183
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
184

185
        // JSConsumerNotFoundErr consumer not found
186
        JSConsumerNotFoundErr ErrorIdentifier = 10014
187

188
        // JSConsumerOfflineErr consumer is offline
189
        JSConsumerOfflineErr ErrorIdentifier = 10119
190

191
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
192
        JSConsumerOnMappedErr ErrorIdentifier = 10092
193

194
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
195
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
196

197
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
198
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
199

200
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
201
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
202

203
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
204
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
205

206
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
207
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
208

209
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
210
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
211

212
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
213
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
214

215
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
216
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
217

218
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
219
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
220

221
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
222
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
223

224
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
225
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
226

227
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
228
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
229

230
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
231
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
232

233
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
234
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
235

236
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
237
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
238

239
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
240
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
241

242
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
243
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
244

245
        // JSInsufficientResourcesErr insufficient resources
246
        JSInsufficientResourcesErr ErrorIdentifier = 10023
247

248
        // JSInvalidJSONErr invalid JSON: {err}
249
        JSInvalidJSONErr ErrorIdentifier = 10025
250

251
        // JSMaximumConsumersLimitErr maximum consumers limit reached
252
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
253

254
        // JSMaximumStreamsLimitErr maximum number of streams reached
255
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
256

257
        // JSMemoryResourcesExceededErr insufficient memory resources available
258
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
259

260
        // JSMessageCounterBrokenErr message counter is broken
261
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
262

263
        // JSMessageIncrDisabledErr message counters is disabled
264
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
265

266
        // JSMessageIncrInvalidErr message counter increment is invalid
267
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
268

269
        // JSMessageIncrMissingErr message counter increment is missing
270
        JSMessageIncrMissingErr ErrorIdentifier = 10169
271

272
        // JSMessageIncrPayloadErr message counter has payload
273
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
274

275
        // JSMessageTTLDisabledErr per-message TTL is disabled
276
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
277

278
        // JSMessageTTLInvalidErr invalid per-message TTL
279
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
280

281
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
282
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
283

284
        // JSMirrorInvalidStreamName mirrored stream name is invalid
285
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
286

287
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
288
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
289

290
        // JSMirrorInvalidTransformDestination mirror transform: {err}
291
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
292

293
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
294
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
295

296
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
297
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
298

299
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
300
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
301

302
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
303
        JSMirrorWithCountersErr ErrorIdentifier = 10173
304

305
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
306
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
307

308
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
309
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
310

311
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
312
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
313

314
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
315
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
316

317
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
318
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
319

320
        // JSNoAccountErr account not found
321
        JSNoAccountErr ErrorIdentifier = 10035
322

323
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
324
        JSNoLimitsErr ErrorIdentifier = 10120
325

326
        // JSNoMessageFoundErr no message found
327
        JSNoMessageFoundErr ErrorIdentifier = 10037
328

329
        // JSNotEmptyRequestErr expected an empty request payload
330
        JSNotEmptyRequestErr ErrorIdentifier = 10038
331

332
        // JSNotEnabledErr JetStream not enabled
333
        JSNotEnabledErr ErrorIdentifier = 10076
334

335
        // JSNotEnabledForAccountErr JetStream not enabled for account
336
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
337

338
        // JSPedanticErrF pedantic mode: {err}
339
        JSPedanticErrF ErrorIdentifier = 10157
340

341
        // JSPeerRemapErr peer remap failed
342
        JSPeerRemapErr ErrorIdentifier = 10075
343

344
        // JSRaftGeneralErrF General RAFT error string ({err})
345
        JSRaftGeneralErrF ErrorIdentifier = 10041
346

347
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
348
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
349

350
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
351
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
352

353
        // JSSequenceNotFoundErrF sequence {seq} not found
354
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
355

356
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
357
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
358

359
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
360
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
361

362
        // JSSourceDuplicateDetected source stream, filter and transform (plus external if present) must form a unique combination (duplicate source configuration detected)
363
        JSSourceDuplicateDetected ErrorIdentifier = 10140
364

365
        // JSSourceInvalidStreamName sourced stream name is invalid
366
        JSSourceInvalidStreamName ErrorIdentifier = 10141
367

368
        // JSSourceInvalidSubjectFilter source transform source: {err}
369
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
370

371
        // JSSourceInvalidTransformDestination source transform: {err}
372
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
373

374
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
375
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
376

377
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
378
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
379

380
        // JSSourceOverlappingSubjectFilters source filters can not overlap
381
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
382

383
        // JSStorageResourcesExceededErr insufficient storage resources available
384
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
385

386
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
387
        JSStreamAssignmentErrF ErrorIdentifier = 10048
388

389
        // JSStreamCreateErrF Generic stream creation error string ({err})
390
        JSStreamCreateErrF ErrorIdentifier = 10049
391

392
        // JSStreamDeleteErrF General stream deletion error string ({err})
393
        JSStreamDeleteErrF ErrorIdentifier = 10050
394

395
        // JSStreamDuplicateMessageConflict duplicate message id is in process
396
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
397

398
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
399
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
400

401
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
402
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
403

404
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
405
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
406

407
        // JSStreamGeneralErrorF General stream failure string ({err})
408
        JSStreamGeneralErrorF ErrorIdentifier = 10051
409

410
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
411
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
412

413
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
414
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
415

416
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
417
        JSStreamInvalidConfigF ErrorIdentifier = 10052
418

419
        // JSStreamInvalidErr stream not valid
420
        JSStreamInvalidErr ErrorIdentifier = 10096
421

422
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
423
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
424

425
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
426
        JSStreamLimitsErrF ErrorIdentifier = 10053
427

428
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
429
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
430

431
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
432
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
433

434
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
435
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
436

437
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
438
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
439

440
        // JSStreamMismatchErr stream name in subject does not match request
441
        JSStreamMismatchErr ErrorIdentifier = 10056
442

443
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
444
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
445

446
        // JSStreamMoveInProgressF stream move already in progress: {msg}
447
        JSStreamMoveInProgressF ErrorIdentifier = 10124
448

449
        // JSStreamMoveNotInProgress stream move not in progress
450
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
451

452
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
453
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
454

455
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
456
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
457

458
        // JSStreamNameExistErr stream name already in use with a different configuration
459
        JSStreamNameExistErr ErrorIdentifier = 10058
460

461
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
462
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
463

464
        // JSStreamNotFoundErr stream not found
465
        JSStreamNotFoundErr ErrorIdentifier = 10059
466

467
        // JSStreamNotMatchErr expected stream does not match
468
        JSStreamNotMatchErr ErrorIdentifier = 10060
469

470
        // JSStreamOfflineErr stream is offline
471
        JSStreamOfflineErr ErrorIdentifier = 10118
472

473
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
474
        JSStreamPurgeFailedF ErrorIdentifier = 10110
475

476
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
477
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
478

479
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
480
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
481

482
        // JSStreamRestoreErrF restore failed: {err}
483
        JSStreamRestoreErrF ErrorIdentifier = 10062
484

485
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
486
        JSStreamRollupFailedF ErrorIdentifier = 10111
487

488
        // JSStreamSealedErr invalid operation on sealed stream
489
        JSStreamSealedErr ErrorIdentifier = 10109
490

491
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
492
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
493

494
        // JSStreamSnapshotErrF snapshot failed: {err}
495
        JSStreamSnapshotErrF ErrorIdentifier = 10064
496

497
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
498
        JSStreamStoreFailedF ErrorIdentifier = 10077
499

500
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
501
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
502

503
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
504
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
505

506
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
507
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
508

509
        // JSStreamTemplateNotFoundErr template not found
510
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
511

512
        // JSStreamTooManyRequests too many requests
513
        JSStreamTooManyRequests ErrorIdentifier = 10167
514

515
        // JSStreamTransformInvalidDestination stream transform: {err}
516
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
517

518
        // JSStreamTransformInvalidSource stream transform source: {err}
519
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
520

521
        // JSStreamUpdateErrF Generic stream update error string ({err})
522
        JSStreamUpdateErrF ErrorIdentifier = 10069
523

524
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
525
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
526

527
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
528
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
529

530
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
531
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
532

533
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
534
        JSTempStorageFailedErr ErrorIdentifier = 10072
535

536
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
537
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
538
)
539

540
var (
541
        ApiErrors = map[ErrorIdentifier]*ApiError{
542
                JSAccountResourcesExceededErr:              {Code: 400, ErrCode: 10002, Description: "resource limits exceeded for account"},
543
                JSAtomicPublishDisabledErr:                 {Code: 400, ErrCode: 10174, Description: "atomic publish is disabled"},
544
                JSAtomicPublishIncompleteBatchErr:          {Code: 400, ErrCode: 10176, Description: "atomic publish batch is incomplete"},
545
                JSAtomicPublishMissingSeqErr:               {Code: 400, ErrCode: 10175, Description: "atomic publish sequence is missing"},
546
                JSAtomicPublishUnsupportedHeaderBatchErr:   {Code: 400, ErrCode: 10177, Description: "atomic publish unsupported header used: {header}"},
547
                JSBadRequestErr:                            {Code: 400, ErrCode: 10003, Description: "bad request"},
548
                JSClusterIncompleteErr:                     {Code: 503, ErrCode: 10004, Description: "incomplete results"},
549
                JSClusterNoPeersErrF:                       {Code: 400, ErrCode: 10005, Description: "{err}"},
550
                JSClusterNotActiveErr:                      {Code: 500, ErrCode: 10006, Description: "JetStream not in clustered mode"},
551
                JSClusterNotAssignedErr:                    {Code: 500, ErrCode: 10007, Description: "JetStream cluster not assigned to this server"},
552
                JSClusterNotAvailErr:                       {Code: 503, ErrCode: 10008, Description: "JetStream system temporarily unavailable"},
553
                JSClusterNotLeaderErr:                      {Code: 500, ErrCode: 10009, Description: "JetStream cluster can not handle request"},
554
                JSClusterPeerNotMemberErr:                  {Code: 400, ErrCode: 10040, Description: "peer not a member"},
555
                JSClusterRequiredErr:                       {Code: 503, ErrCode: 10010, Description: "JetStream clustering support required"},
556
                JSClusterServerNotMemberErr:                {Code: 400, ErrCode: 10044, Description: "server is not a member of the cluster"},
557
                JSClusterTagsErr:                           {Code: 400, ErrCode: 10011, Description: "tags placement not supported for operation"},
558
                JSClusterUnSupportFeatureErr:               {Code: 503, ErrCode: 10036, Description: "not currently supported in clustered mode"},
559
                JSConsumerAlreadyExists:                    {Code: 400, ErrCode: 10148, Description: "consumer already exists"},
560
                JSConsumerBadDurableNameErr:                {Code: 400, ErrCode: 10103, Description: "durable name can not contain '.', '*', '>'"},
561
                JSConsumerConfigRequiredErr:                {Code: 400, ErrCode: 10078, Description: "consumer config required"},
562
                JSConsumerCreateDurableAndNameMismatch:     {Code: 400, ErrCode: 10132, Description: "Consumer Durable and Name have to be equal if both are provided"},
563
                JSConsumerCreateErrF:                       {Code: 500, ErrCode: 10012, Description: "{err}"},
564
                JSConsumerCreateFilterSubjectMismatchErr:   {Code: 400, ErrCode: 10131, Description: "Consumer create request did not match filtered subject from create subject"},
565
                JSConsumerDeliverCycleErr:                  {Code: 400, ErrCode: 10081, Description: "consumer deliver subject forms a cycle"},
566
                JSConsumerDeliverToWildcardsErr:            {Code: 400, ErrCode: 10079, Description: "consumer deliver subject has wildcards"},
567
                JSConsumerDescriptionTooLongErrF:           {Code: 400, ErrCode: 10107, Description: "consumer description is too long, maximum allowed is {max}"},
568
                JSConsumerDirectRequiresEphemeralErr:       {Code: 400, ErrCode: 10091, Description: "consumer direct requires an ephemeral consumer"},
569
                JSConsumerDirectRequiresPushErr:            {Code: 400, ErrCode: 10090, Description: "consumer direct requires a push based consumer"},
570
                JSConsumerDoesNotExist:                     {Code: 400, ErrCode: 10149, Description: "consumer does not exist"},
571
                JSConsumerDuplicateFilterSubjects:          {Code: 400, ErrCode: 10136, Description: "consumer cannot have both FilterSubject and FilterSubjects specified"},
572
                JSConsumerDurableNameNotInSubjectErr:       {Code: 400, ErrCode: 10016, Description: "consumer expected to be durable but no durable name set in subject"},
573
                JSConsumerDurableNameNotMatchSubjectErr:    {Code: 400, ErrCode: 10017, Description: "consumer name in subject does not match durable name in request"},
574
                JSConsumerDurableNameNotSetErr:             {Code: 400, ErrCode: 10018, Description: "consumer expected to be durable but a durable name was not set"},
575
                JSConsumerEmptyFilter:                      {Code: 400, ErrCode: 10139, Description: "consumer filter in FilterSubjects cannot be empty"},
576
                JSConsumerEmptyGroupName:                   {Code: 400, ErrCode: 10161, Description: "Group name cannot be an empty string"},
577
                JSConsumerEphemeralWithDurableInSubjectErr: {Code: 400, ErrCode: 10019, Description: "consumer expected to be ephemeral but detected a durable name set in subject"},
578
                JSConsumerEphemeralWithDurableNameErr:      {Code: 400, ErrCode: 10020, Description: "consumer expected to be ephemeral but a durable name was set in request"},
579
                JSConsumerExistingActiveErr:                {Code: 400, ErrCode: 10105, Description: "consumer already exists and is still active"},
580
                JSConsumerFCRequiresPushErr:                {Code: 400, ErrCode: 10089, Description: "consumer flow control requires a push based consumer"},
581
                JSConsumerFilterNotSubsetErr:               {Code: 400, ErrCode: 10093, Description: "consumer filter subject is not a valid subset of the interest subjects"},
582
                JSConsumerHBRequiresPushErr:                {Code: 400, ErrCode: 10088, Description: "consumer idle heartbeat requires a push based consumer"},
583
                JSConsumerInactiveThresholdExcess:          {Code: 400, ErrCode: 10153, Description: "consumer inactive threshold exceeds system limit of {limit}"},
584
                JSConsumerInvalidDeliverSubject:            {Code: 400, ErrCode: 10112, Description: "invalid push consumer deliver subject"},
585
                JSConsumerInvalidGroupNameErr:              {Code: 400, ErrCode: 10162, Description: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"},
586
                JSConsumerInvalidPolicyErrF:                {Code: 400, ErrCode: 10094, Description: "{err}"},
587
                JSConsumerInvalidPriorityGroupErr:          {Code: 400, ErrCode: 10160, Description: "Provided priority group does not exist for this consumer"},
588
                JSConsumerInvalidSamplingErrF:              {Code: 400, ErrCode: 10095, Description: "failed to parse consumer sampling configuration: {err}"},
589
                JSConsumerMaxDeliverBackoffErr:             {Code: 400, ErrCode: 10116, Description: "max deliver is required to be > length of backoff values"},
590
                JSConsumerMaxPendingAckExcessErrF:          {Code: 400, ErrCode: 10121, Description: "consumer max ack pending exceeds system limit of {limit}"},
591
                JSConsumerMaxPendingAckPolicyRequiredErr:   {Code: 400, ErrCode: 10082, Description: "consumer requires ack policy for max ack pending"},
592
                JSConsumerMaxRequestBatchExceededF:         {Code: 400, ErrCode: 10125, Description: "consumer max request batch exceeds server limit of {limit}"},
593
                JSConsumerMaxRequestBatchNegativeErr:       {Code: 400, ErrCode: 10114, Description: "consumer max request batch needs to be > 0"},
594
                JSConsumerMaxRequestExpiresToSmall:         {Code: 400, ErrCode: 10115, Description: "consumer max request expires needs to be >= 1ms"},
595
                JSConsumerMaxWaitingNegativeErr:            {Code: 400, ErrCode: 10087, Description: "consumer max waiting needs to be positive"},
596
                JSConsumerMetadataLengthErrF:               {Code: 400, ErrCode: 10135, Description: "consumer metadata exceeds maximum size of {limit}"},
597
                JSConsumerMultipleFiltersNotAllowed:        {Code: 400, ErrCode: 10137, Description: "consumer with multiple subject filters cannot use subject based API"},
598
                JSConsumerNameContainsPathSeparatorsErr:    {Code: 400, ErrCode: 10127, Description: "Consumer name can not contain path separators"},
599
                JSConsumerNameExistErr:                     {Code: 400, ErrCode: 10013, Description: "consumer name already in use"},
600
                JSConsumerNameTooLongErrF:                  {Code: 400, ErrCode: 10102, Description: "consumer name is too long, maximum allowed is {max}"},
601
                JSConsumerNotFoundErr:                      {Code: 404, ErrCode: 10014, Description: "consumer not found"},
602
                JSConsumerOfflineErr:                       {Code: 500, ErrCode: 10119, Description: "consumer is offline"},
603
                JSConsumerOnMappedErr:                      {Code: 400, ErrCode: 10092, Description: "consumer direct on a mapped consumer"},
604
                JSConsumerOverlappingSubjectFilters:        {Code: 400, ErrCode: 10138, Description: "consumer subject filters cannot overlap"},
605
                JSConsumerPriorityPolicyWithoutGroup:       {Code: 400, ErrCode: 10159, Description: "Setting PriorityPolicy requires at least one PriorityGroup to be set"},
606
                JSConsumerPullNotDurableErr:                {Code: 400, ErrCode: 10085, Description: "consumer in pull mode requires a durable name"},
607
                JSConsumerPullRequiresAckErr:               {Code: 400, ErrCode: 10084, Description: "consumer in pull mode requires explicit ack policy on workqueue stream"},
608
                JSConsumerPullWithRateLimitErr:             {Code: 400, ErrCode: 10086, Description: "consumer in pull mode can not have rate limit set"},
609
                JSConsumerPushMaxWaitingErr:                {Code: 400, ErrCode: 10080, Description: "consumer in push mode can not set max waiting"},
610
                JSConsumerPushWithPriorityGroupErr:         {Code: 400, ErrCode: 10178, Description: "priority groups can not be used with push consumers"},
611
                JSConsumerReplacementWithDifferentNameErr:  {Code: 400, ErrCode: 10106, Description: "consumer replacement durable config not the same"},
612
                JSConsumerReplicasExceedsStream:            {Code: 400, ErrCode: 10126, Description: "consumer config replica count exceeds parent stream"},
613
                JSConsumerReplicasShouldMatchStream:        {Code: 400, ErrCode: 10134, Description: "consumer config replicas must match interest retention stream's replicas"},
614
                JSConsumerSmallHeartbeatErr:                {Code: 400, ErrCode: 10083, Description: "consumer idle heartbeat needs to be >= 100ms"},
615
                JSConsumerStoreFailedErrF:                  {Code: 500, ErrCode: 10104, Description: "error creating store for consumer: {err}"},
616
                JSConsumerWQConsumerNotDeliverAllErr:       {Code: 400, ErrCode: 10101, Description: "consumer must be deliver all on workqueue stream"},
617
                JSConsumerWQConsumerNotUniqueErr:           {Code: 400, ErrCode: 10100, Description: "filtered consumer not unique on workqueue stream"},
618
                JSConsumerWQMultipleUnfilteredErr:          {Code: 400, ErrCode: 10099, Description: "multiple non-filtered consumers not allowed on workqueue stream"},
619
                JSConsumerWQRequiresExplicitAckErr:         {Code: 400, ErrCode: 10098, Description: "workqueue stream requires explicit ack"},
620
                JSConsumerWithFlowControlNeedsHeartbeats:   {Code: 400, ErrCode: 10108, Description: "consumer with flow control also needs heartbeats"},
621
                JSInsufficientResourcesErr:                 {Code: 503, ErrCode: 10023, Description: "insufficient resources"},
622
                JSInvalidJSONErr:                           {Code: 400, ErrCode: 10025, Description: "invalid JSON: {err}"},
623
                JSMaximumConsumersLimitErr:                 {Code: 400, ErrCode: 10026, Description: "maximum consumers limit reached"},
624
                JSMaximumStreamsLimitErr:                   {Code: 400, ErrCode: 10027, Description: "maximum number of streams reached"},
625
                JSMemoryResourcesExceededErr:               {Code: 500, ErrCode: 10028, Description: "insufficient memory resources available"},
626
                JSMessageCounterBrokenErr:                  {Code: 400, ErrCode: 10172, Description: "message counter is broken"},
627
                JSMessageIncrDisabledErr:                   {Code: 400, ErrCode: 10168, Description: "message counters is disabled"},
628
                JSMessageIncrInvalidErr:                    {Code: 400, ErrCode: 10171, Description: "message counter increment is invalid"},
629
                JSMessageIncrMissingErr:                    {Code: 400, ErrCode: 10169, Description: "message counter increment is missing"},
630
                JSMessageIncrPayloadErr:                    {Code: 400, ErrCode: 10170, Description: "message counter has payload"},
631
                JSMessageTTLDisabledErr:                    {Code: 400, ErrCode: 10166, Description: "per-message TTL is disabled"},
632
                JSMessageTTLInvalidErr:                     {Code: 400, ErrCode: 10165, Description: "invalid per-message TTL"},
633
                JSMirrorConsumerSetupFailedErrF:            {Code: 500, ErrCode: 10029, Description: "{err}"},
634
                JSMirrorInvalidStreamName:                  {Code: 400, ErrCode: 10142, Description: "mirrored stream name is invalid"},
635
                JSMirrorInvalidSubjectFilter:               {Code: 400, ErrCode: 10151, Description: "mirror transform source: {err}"},
636
                JSMirrorInvalidTransformDestination:        {Code: 400, ErrCode: 10154, Description: "mirror transform: {err}"},
637
                JSMirrorMaxMessageSizeTooBigErr:            {Code: 400, ErrCode: 10030, Description: "stream mirror must have max message size >= source"},
638
                JSMirrorMultipleFiltersNotAllowed:          {Code: 400, ErrCode: 10150, Description: "mirror with multiple subject transforms cannot also have a single subject filter"},
639
                JSMirrorOverlappingSubjectFilters:          {Code: 400, ErrCode: 10152, Description: "mirror subject filters can not overlap"},
640
                JSMirrorWithCountersErr:                    {Code: 400, ErrCode: 10173, Description: "stream mirrors can not also calculate counters"},
641
                JSMirrorWithFirstSeqErr:                    {Code: 400, ErrCode: 10143, Description: "stream mirrors can not have first sequence configured"},
642
                JSMirrorWithSourcesErr:                     {Code: 400, ErrCode: 10031, Description: "stream mirrors can not also contain other sources"},
643
                JSMirrorWithStartSeqAndTimeErr:             {Code: 400, ErrCode: 10032, Description: "stream mirrors can not have both start seq and start time configured"},
644
                JSMirrorWithSubjectFiltersErr:              {Code: 400, ErrCode: 10033, Description: "stream mirrors can not contain filtered subjects"},
645
                JSMirrorWithSubjectsErr:                    {Code: 400, ErrCode: 10034, Description: "stream mirrors can not contain subjects"},
646
                JSNoAccountErr:                             {Code: 503, ErrCode: 10035, Description: "account not found"},
647
                JSNoLimitsErr:                              {Code: 400, ErrCode: 10120, Description: "no JetStream default or applicable tiered limit present"},
648
                JSNoMessageFoundErr:                        {Code: 404, ErrCode: 10037, Description: "no message found"},
649
                JSNotEmptyRequestErr:                       {Code: 400, ErrCode: 10038, Description: "expected an empty request payload"},
650
                JSNotEnabledErr:                            {Code: 503, ErrCode: 10076, Description: "JetStream not enabled"},
651
                JSNotEnabledForAccountErr:                  {Code: 503, ErrCode: 10039, Description: "JetStream not enabled for account"},
652
                JSPedanticErrF:                             {Code: 400, ErrCode: 10157, Description: "pedantic mode: {err}"},
653
                JSPeerRemapErr:                             {Code: 503, ErrCode: 10075, Description: "peer remap failed"},
654
                JSRaftGeneralErrF:                          {Code: 500, ErrCode: 10041, Description: "{err}"},
655
                JSReplicasCountCannotBeNegative:            {Code: 400, ErrCode: 10133, Description: "replicas count cannot be negative"},
656
                JSRestoreSubscribeFailedErrF:               {Code: 500, ErrCode: 10042, Description: "JetStream unable to subscribe to restore snapshot {subject}: {err}"},
657
                JSSequenceNotFoundErrF:                     {Code: 400, ErrCode: 10043, Description: "sequence {seq} not found"},
658
                JSSnapshotDeliverSubjectInvalidErr:         {Code: 400, ErrCode: 10015, Description: "deliver subject not valid"},
659
                JSSourceConsumerSetupFailedErrF:            {Code: 500, ErrCode: 10045, Description: "{err}"},
660
                JSSourceDuplicateDetected:                  {Code: 400, ErrCode: 10140, Description: "duplicate source configuration detected"},
661
                JSSourceInvalidStreamName:                  {Code: 400, ErrCode: 10141, Description: "sourced stream name is invalid"},
662
                JSSourceInvalidSubjectFilter:               {Code: 400, ErrCode: 10145, Description: "source transform source: {err}"},
663
                JSSourceInvalidTransformDestination:        {Code: 400, ErrCode: 10146, Description: "source transform: {err}"},
664
                JSSourceMaxMessageSizeTooBigErr:            {Code: 400, ErrCode: 10046, Description: "stream source must have max message size >= target"},
665
                JSSourceMultipleFiltersNotAllowed:          {Code: 400, ErrCode: 10144, Description: "source with multiple subject transforms cannot also have a single subject filter"},
666
                JSSourceOverlappingSubjectFilters:          {Code: 400, ErrCode: 10147, Description: "source filters can not overlap"},
667
                JSStorageResourcesExceededErr:              {Code: 500, ErrCode: 10047, Description: "insufficient storage resources available"},
668
                JSStreamAssignmentErrF:                     {Code: 500, ErrCode: 10048, Description: "{err}"},
669
                JSStreamCreateErrF:                         {Code: 500, ErrCode: 10049, Description: "{err}"},
670
                JSStreamDeleteErrF:                         {Code: 500, ErrCode: 10050, Description: "{err}"},
671
                JSStreamDuplicateMessageConflict:           {Code: 409, ErrCode: 10158, Description: "duplicate message id is in process"},
672
                JSStreamExpectedLastSeqPerSubjectNotReady:  {Code: 503, ErrCode: 10163, Description: "expected last sequence per subject temporarily unavailable"},
673
                JSStreamExternalApiOverlapErrF:             {Code: 400, ErrCode: 10021, Description: "stream external api prefix {prefix} must not overlap with {subject}"},
674
                JSStreamExternalDelPrefixOverlapsErrF:      {Code: 400, ErrCode: 10022, Description: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"},
675
                JSStreamGeneralErrorF:                      {Code: 500, ErrCode: 10051, Description: "{err}"},
676
                JSStreamHeaderExceedsMaximumErr:            {Code: 400, ErrCode: 10097, Description: "header size exceeds maximum allowed of 64k"},
677
                JSStreamInfoMaxSubjectsErr:                 {Code: 500, ErrCode: 10117, Description: "subject details would exceed maximum allowed"},
678
                JSStreamInvalidConfigF:                     {Code: 500, ErrCode: 10052, Description: "{err}"},
679
                JSStreamInvalidErr:                         {Code: 500, ErrCode: 10096, Description: "stream not valid"},
680
                JSStreamInvalidExternalDeliverySubjErrF:    {Code: 400, ErrCode: 10024, Description: "stream external delivery prefix {prefix} must not contain wildcards"},
681
                JSStreamLimitsErrF:                         {Code: 500, ErrCode: 10053, Description: "{err}"},
682
                JSStreamMaxBytesRequired:                   {Code: 400, ErrCode: 10113, Description: "account requires a stream config to have max bytes set"},
683
                JSStreamMaxStreamBytesExceeded:             {Code: 400, ErrCode: 10122, Description: "stream max bytes exceeds account limit max stream bytes"},
684
                JSStreamMessageExceedsMaximumErr:           {Code: 400, ErrCode: 10054, Description: "message size exceeds maximum allowed"},
685
                JSStreamMirrorNotUpdatableErr:              {Code: 400, ErrCode: 10055, Description: "stream mirror configuration can not be updated"},
686
                JSStreamMismatchErr:                        {Code: 400, ErrCode: 10056, Description: "stream name in subject does not match request"},
687
                JSStreamMoveAndScaleErr:                    {Code: 400, ErrCode: 10123, Description: "can not move and scale a stream in a single update"},
688
                JSStreamMoveInProgressF:                    {Code: 400, ErrCode: 10124, Description: "stream move already in progress: {msg}"},
689
                JSStreamMoveNotInProgress:                  {Code: 400, ErrCode: 10129, Description: "stream move not in progress"},
690
                JSStreamMsgDeleteFailedF:                   {Code: 500, ErrCode: 10057, Description: "{err}"},
691
                JSStreamNameContainsPathSeparatorsErr:      {Code: 400, ErrCode: 10128, Description: "Stream name can not contain path separators"},
692
                JSStreamNameExistErr:                       {Code: 400, ErrCode: 10058, Description: "stream name already in use with a different configuration"},
693
                JSStreamNameExistRestoreFailedErr:          {Code: 400, ErrCode: 10130, Description: "stream name already in use, cannot restore"},
694
                JSStreamNotFoundErr:                        {Code: 404, ErrCode: 10059, Description: "stream not found"},
695
                JSStreamNotMatchErr:                        {Code: 400, ErrCode: 10060, Description: "expected stream does not match"},
696
                JSStreamOfflineErr:                         {Code: 500, ErrCode: 10118, Description: "stream is offline"},
697
                JSStreamPurgeFailedF:                       {Code: 500, ErrCode: 10110, Description: "{err}"},
698
                JSStreamReplicasNotSupportedErr:            {Code: 500, ErrCode: 10074, Description: "replicas > 1 not supported in non-clustered mode"},
699
                JSStreamReplicasNotUpdatableErr:            {Code: 400, ErrCode: 10061, Description: "Replicas configuration can not be updated"},
700
                JSStreamRestoreErrF:                        {Code: 500, ErrCode: 10062, Description: "restore failed: {err}"},
701
                JSStreamRollupFailedF:                      {Code: 500, ErrCode: 10111, Description: "{err}"},
702
                JSStreamSealedErr:                          {Code: 400, ErrCode: 10109, Description: "invalid operation on sealed stream"},
703
                JSStreamSequenceNotMatchErr:                {Code: 503, ErrCode: 10063, Description: "expected stream sequence does not match"},
704
                JSStreamSnapshotErrF:                       {Code: 500, ErrCode: 10064, Description: "snapshot failed: {err}"},
705
                JSStreamStoreFailedF:                       {Code: 503, ErrCode: 10077, Description: "{err}"},
706
                JSStreamSubjectOverlapErr:                  {Code: 400, ErrCode: 10065, Description: "subjects overlap with an existing stream"},
707
                JSStreamTemplateCreateErrF:                 {Code: 500, ErrCode: 10066, Description: "{err}"},
708
                JSStreamTemplateDeleteErrF:                 {Code: 500, ErrCode: 10067, Description: "{err}"},
709
                JSStreamTemplateNotFoundErr:                {Code: 404, ErrCode: 10068, Description: "template not found"},
710
                JSStreamTooManyRequests:                    {Code: 429, ErrCode: 10167, Description: "too many requests"},
711
                JSStreamTransformInvalidDestination:        {Code: 400, ErrCode: 10156, Description: "stream transform: {err}"},
712
                JSStreamTransformInvalidSource:             {Code: 400, ErrCode: 10155, Description: "stream transform source: {err}"},
713
                JSStreamUpdateErrF:                         {Code: 500, ErrCode: 10069, Description: "{err}"},
714
                JSStreamWrongLastMsgIDErrF:                 {Code: 400, ErrCode: 10070, Description: "wrong last msg ID: {id}"},
715
                JSStreamWrongLastSequenceConstantErr:       {Code: 400, ErrCode: 10164, Description: "wrong last sequence"},
716
                JSStreamWrongLastSequenceErrF:              {Code: 400, ErrCode: 10071, Description: "wrong last sequence: {seq}"},
717
                JSTempStorageFailedErr:                     {Code: 500, ErrCode: 10072, Description: "JetStream unable to open temp storage for restore"},
718
                JSTemplateNameNotMatchSubjectErr:           {Code: 400, ErrCode: 10073, Description: "template name in subject does not match request"},
719
        }
720
        // ErrJetStreamNotClustered Deprecated by JSClusterNotActiveErr ApiError, use IsNatsError() for comparisons
721
        ErrJetStreamNotClustered = ApiErrors[JSClusterNotActiveErr]
722
        // ErrJetStreamNotAssigned Deprecated by JSClusterNotAssignedErr ApiError, use IsNatsError() for comparisons
723
        ErrJetStreamNotAssigned = ApiErrors[JSClusterNotAssignedErr]
724
        // ErrJetStreamNotLeader Deprecated by JSClusterNotLeaderErr ApiError, use IsNatsError() for comparisons
725
        ErrJetStreamNotLeader = ApiErrors[JSClusterNotLeaderErr]
726
        // ErrJetStreamConsumerAlreadyUsed Deprecated by JSConsumerNameExistErr ApiError, use IsNatsError() for comparisons
727
        ErrJetStreamConsumerAlreadyUsed = ApiErrors[JSConsumerNameExistErr]
728
        // ErrJetStreamResourcesExceeded Deprecated by JSInsufficientResourcesErr ApiError, use IsNatsError() for comparisons
729
        ErrJetStreamResourcesExceeded = ApiErrors[JSInsufficientResourcesErr]
730
        // ErrMemoryResourcesExceeded Deprecated by JSMemoryResourcesExceededErr ApiError, use IsNatsError() for comparisons
731
        ErrMemoryResourcesExceeded = ApiErrors[JSMemoryResourcesExceededErr]
732
        // ErrJetStreamNotEnabled Deprecated by JSNotEnabledErr ApiError, use IsNatsError() for comparisons
733
        ErrJetStreamNotEnabled = ApiErrors[JSNotEnabledErr]
734
        // ErrStorageResourcesExceeded Deprecated by JSStorageResourcesExceededErr ApiError, use IsNatsError() for comparisons
735
        ErrStorageResourcesExceeded = ApiErrors[JSStorageResourcesExceededErr]
736
        // ErrJetStreamStreamAlreadyUsed Deprecated by JSStreamNameExistErr ApiError, use IsNatsError() for comparisons
737
        ErrJetStreamStreamAlreadyUsed = ApiErrors[JSStreamNameExistErr]
738
        // ErrJetStreamStreamNotFound Deprecated by JSStreamNotFoundErr ApiError, use IsNatsError() for comparisons
739
        ErrJetStreamStreamNotFound = ApiErrors[JSStreamNotFoundErr]
740
        // ErrReplicasNotSupported Deprecated by JSStreamReplicasNotSupportedErr ApiError, use IsNatsError() for comparisons
741
        ErrReplicasNotSupported = ApiErrors[JSStreamReplicasNotSupportedErr]
742
)
743

744
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
745
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,057✔
746
        eopts := parseOpts(opts)
20,057✔
747
        if ae, ok := eopts.err.(*ApiError); ok {
20,057✔
748
                return ae
×
749
        }
×
750

751
        return ApiErrors[JSAccountResourcesExceededErr]
20,057✔
752
}
753

754
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
755
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
12✔
756
        eopts := parseOpts(opts)
12✔
757
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
758
                return ae
×
759
        }
×
760

761
        return ApiErrors[JSAtomicPublishDisabledErr]
12✔
762
}
763

764
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
765
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
24✔
766
        eopts := parseOpts(opts)
24✔
767
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
768
                return ae
×
769
        }
×
770

771
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
24✔
772
}
773

774
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
775
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
12✔
776
        eopts := parseOpts(opts)
12✔
777
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
778
                return ae
×
779
        }
×
780

781
        return ApiErrors[JSAtomicPublishMissingSeqErr]
12✔
782
}
783

784
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
785
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
18✔
786
        eopts := parseOpts(opts)
18✔
787
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
788
                return ae
×
789
        }
×
790

791
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
18✔
792
        args := e.toReplacerArgs([]interface{}{"{header}", header})
18✔
793
        return &ApiError{
18✔
794
                Code:        e.Code,
18✔
795
                ErrCode:     e.ErrCode,
18✔
796
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
797
        }
18✔
798
}
799

800
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
801
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
802
        eopts := parseOpts(opts)
10✔
803
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
804
                return ae
×
805
        }
×
806

807
        return ApiErrors[JSBadRequestErr]
10✔
808
}
809

810
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
811
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
812
        eopts := parseOpts(opts)
×
813
        if ae, ok := eopts.err.(*ApiError); ok {
×
814
                return ae
×
815
        }
×
816

817
        return ApiErrors[JSClusterIncompleteErr]
×
818
}
819

820
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
821
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
60✔
822
        eopts := parseOpts(opts)
60✔
823
        if ae, ok := eopts.err.(*ApiError); ok {
60✔
824
                return ae
×
825
        }
×
826

827
        e := ApiErrors[JSClusterNoPeersErrF]
60✔
828
        args := e.toReplacerArgs([]interface{}{"{err}", err})
60✔
829
        return &ApiError{
60✔
830
                Code:        e.Code,
60✔
831
                ErrCode:     e.ErrCode,
60✔
832
                Description: strings.NewReplacer(args...).Replace(e.Description),
60✔
833
        }
60✔
834
}
835

836
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
837
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
838
        eopts := parseOpts(opts)
1✔
839
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
840
                return ae
×
841
        }
×
842

843
        return ApiErrors[JSClusterNotActiveErr]
1✔
844
}
845

846
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
847
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
27✔
848
        eopts := parseOpts(opts)
27✔
849
        if ae, ok := eopts.err.(*ApiError); ok {
27✔
850
                return ae
×
851
        }
×
852

853
        return ApiErrors[JSClusterNotAssignedErr]
27✔
854
}
855

856
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
857
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
858
        eopts := parseOpts(opts)
13✔
859
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
860
                return ae
×
861
        }
×
862

863
        return ApiErrors[JSClusterNotAvailErr]
13✔
864
}
865

866
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
867
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
8✔
868
        eopts := parseOpts(opts)
8✔
869
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
870
                return ae
×
871
        }
×
872

873
        return ApiErrors[JSClusterNotLeaderErr]
8✔
874
}
875

876
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
877
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
878
        eopts := parseOpts(opts)
1✔
879
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
880
                return ae
×
881
        }
×
882

883
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
884
}
885

886
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
887
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
888
        eopts := parseOpts(opts)
×
889
        if ae, ok := eopts.err.(*ApiError); ok {
×
890
                return ae
×
891
        }
×
892

893
        return ApiErrors[JSClusterRequiredErr]
×
894
}
895

896
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
897
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
898
        eopts := parseOpts(opts)
3✔
899
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
900
                return ae
×
901
        }
×
902

903
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
904
}
905

906
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
907
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
908
        eopts := parseOpts(opts)
×
909
        if ae, ok := eopts.err.(*ApiError); ok {
×
910
                return ae
×
911
        }
×
912

913
        return ApiErrors[JSClusterTagsErr]
×
914
}
915

916
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
917
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
918
        eopts := parseOpts(opts)
6✔
919
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
920
                return ae
×
921
        }
×
922

923
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
924
}
925

926
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
927
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
928
        eopts := parseOpts(opts)
5✔
929
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
930
                return ae
×
931
        }
×
932

933
        return ApiErrors[JSConsumerAlreadyExists]
5✔
934
}
935

936
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
937
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
938
        eopts := parseOpts(opts)
×
939
        if ae, ok := eopts.err.(*ApiError); ok {
×
940
                return ae
×
941
        }
×
942

943
        return ApiErrors[JSConsumerBadDurableNameErr]
×
944
}
945

946
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
947
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
948
        eopts := parseOpts(opts)
2✔
949
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
950
                return ae
×
951
        }
×
952

953
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
954
}
955

956
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
957
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
958
        eopts := parseOpts(opts)
1✔
959
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
960
                return ae
×
961
        }
×
962

963
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
964
}
965

966
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
967
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
69✔
968
        eopts := parseOpts(opts)
69✔
969
        if ae, ok := eopts.err.(*ApiError); ok {
120✔
970
                return ae
51✔
971
        }
51✔
972

973
        e := ApiErrors[JSConsumerCreateErrF]
18✔
974
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
975
        return &ApiError{
18✔
976
                Code:        e.Code,
18✔
977
                ErrCode:     e.ErrCode,
18✔
978
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
979
        }
18✔
980
}
981

982
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
983
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
984
        eopts := parseOpts(opts)
2✔
985
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
986
                return ae
×
987
        }
×
988

989
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
990
}
991

992
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
993
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
994
        eopts := parseOpts(opts)
4✔
995
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
996
                return ae
×
997
        }
×
998

999
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1000
}
1001

1002
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1003
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1004
        eopts := parseOpts(opts)
4✔
1005
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1006
                return ae
×
1007
        }
×
1008

1009
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1010
}
1011

1012
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1013
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1014
        eopts := parseOpts(opts)
1✔
1015
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1016
                return ae
×
1017
        }
×
1018

1019
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1020
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1021
        return &ApiError{
1✔
1022
                Code:        e.Code,
1✔
1023
                ErrCode:     e.ErrCode,
1✔
1024
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1025
        }
1✔
1026
}
1027

1028
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1029
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1030
        eopts := parseOpts(opts)
×
1031
        if ae, ok := eopts.err.(*ApiError); ok {
×
1032
                return ae
×
1033
        }
×
1034

1035
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1036
}
1037

1038
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1039
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1040
        eopts := parseOpts(opts)
×
1041
        if ae, ok := eopts.err.(*ApiError); ok {
×
1042
                return ae
×
1043
        }
×
1044

1045
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1046
}
1047

1048
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1049
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1050
        eopts := parseOpts(opts)
3✔
1051
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1052
                return ae
×
1053
        }
×
1054

1055
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1056
}
1057

1058
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1059
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1060
        eopts := parseOpts(opts)
1✔
1061
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1062
                return ae
×
1063
        }
×
1064

1065
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1066
}
1067

1068
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1069
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1070
        eopts := parseOpts(opts)
×
1071
        if ae, ok := eopts.err.(*ApiError); ok {
×
1072
                return ae
×
1073
        }
×
1074

1075
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1076
}
1077

1078
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1079
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1080
        eopts := parseOpts(opts)
×
1081
        if ae, ok := eopts.err.(*ApiError); ok {
×
1082
                return ae
×
1083
        }
×
1084

1085
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1086
}
1087

1088
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1089
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1090
        eopts := parseOpts(opts)
1✔
1091
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1092
                return ae
×
1093
        }
×
1094

1095
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1096
}
1097

1098
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1099
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1100
        eopts := parseOpts(opts)
1✔
1101
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1102
                return ae
×
1103
        }
×
1104

1105
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1106
}
1107

1108
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1109
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1110
        eopts := parseOpts(opts)
4✔
1111
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1112
                return ae
×
1113
        }
×
1114

1115
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1116
}
1117

1118
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1119
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1120
        eopts := parseOpts(opts)
×
1121
        if ae, ok := eopts.err.(*ApiError); ok {
×
1122
                return ae
×
1123
        }
×
1124

1125
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1126
}
1127

1128
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1129
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1130
        eopts := parseOpts(opts)
3✔
1131
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1132
                return ae
×
1133
        }
×
1134

1135
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1136
}
1137

1138
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1139
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1140
        eopts := parseOpts(opts)
×
1141
        if ae, ok := eopts.err.(*ApiError); ok {
×
1142
                return ae
×
1143
        }
×
1144

1145
        return ApiErrors[JSConsumerExistingActiveErr]
×
1146
}
1147

1148
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1149
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1150
        eopts := parseOpts(opts)
×
1151
        if ae, ok := eopts.err.(*ApiError); ok {
×
1152
                return ae
×
1153
        }
×
1154

1155
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1156
}
1157

1158
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1159
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1160
        eopts := parseOpts(opts)
×
1161
        if ae, ok := eopts.err.(*ApiError); ok {
×
1162
                return ae
×
1163
        }
×
1164

1165
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1166
}
1167

1168
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1169
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1170
        eopts := parseOpts(opts)
×
1171
        if ae, ok := eopts.err.(*ApiError); ok {
×
1172
                return ae
×
1173
        }
×
1174

1175
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1176
}
1177

1178
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1179
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1180
        eopts := parseOpts(opts)
2✔
1181
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1182
                return ae
×
1183
        }
×
1184

1185
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1186
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1187
        return &ApiError{
2✔
1188
                Code:        e.Code,
2✔
1189
                ErrCode:     e.ErrCode,
2✔
1190
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1191
        }
2✔
1192
}
1193

1194
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1195
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1196
        eopts := parseOpts(opts)
2✔
1197
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1198
                return ae
×
1199
        }
×
1200

1201
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1202
}
1203

1204
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1205
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1206
        eopts := parseOpts(opts)
4✔
1207
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1208
                return ae
×
1209
        }
×
1210

1211
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1212
}
1213

1214
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1215
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1216
        eopts := parseOpts(opts)
10✔
1217
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1218
                return ae
×
1219
        }
×
1220

1221
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1222
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1223
        return &ApiError{
10✔
1224
                Code:        e.Code,
10✔
1225
                ErrCode:     e.ErrCode,
10✔
1226
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1227
        }
10✔
1228
}
1229

1230
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1231
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1232
        eopts := parseOpts(opts)
2✔
1233
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1234
                return ae
×
1235
        }
×
1236

1237
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1238
}
1239

1240
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1241
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1242
        eopts := parseOpts(opts)
×
1243
        if ae, ok := eopts.err.(*ApiError); ok {
×
1244
                return ae
×
1245
        }
×
1246

1247
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1248
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1249
        return &ApiError{
×
1250
                Code:        e.Code,
×
1251
                ErrCode:     e.ErrCode,
×
1252
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1253
        }
×
1254
}
1255

1256
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1257
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1258
        eopts := parseOpts(opts)
3✔
1259
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1260
                return ae
×
1261
        }
×
1262

1263
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1264
}
1265

1266
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1267
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1268
        eopts := parseOpts(opts)
12✔
1269
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1270
                return ae
×
1271
        }
×
1272

1273
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1274
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1275
        return &ApiError{
12✔
1276
                Code:        e.Code,
12✔
1277
                ErrCode:     e.ErrCode,
12✔
1278
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1279
        }
12✔
1280
}
1281

1282
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1283
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1284
        eopts := parseOpts(opts)
2✔
1285
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1286
                return ae
×
1287
        }
×
1288

1289
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1290
}
1291

1292
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1293
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1294
        eopts := parseOpts(opts)
4✔
1295
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1296
                return ae
×
1297
        }
×
1298

1299
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1300
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1301
        return &ApiError{
4✔
1302
                Code:        e.Code,
4✔
1303
                ErrCode:     e.ErrCode,
4✔
1304
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1305
        }
4✔
1306
}
1307

1308
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1309
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1310
        eopts := parseOpts(opts)
×
1311
        if ae, ok := eopts.err.(*ApiError); ok {
×
1312
                return ae
×
1313
        }
×
1314

1315
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1316
}
1317

1318
// NewJSConsumerMaxRequestExpiresToSmallError creates a new JSConsumerMaxRequestExpiresToSmall error: "consumer max request expires needs to be >= 1ms"
1319
func NewJSConsumerMaxRequestExpiresToSmallError(opts ...ErrorOption) *ApiError {
×
1320
        eopts := parseOpts(opts)
×
1321
        if ae, ok := eopts.err.(*ApiError); ok {
×
1322
                return ae
×
1323
        }
×
1324

1325
        return ApiErrors[JSConsumerMaxRequestExpiresToSmall]
×
1326
}
1327

1328
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1329
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
2✔
1330
        eopts := parseOpts(opts)
2✔
1331
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1332
                return ae
×
1333
        }
×
1334

1335
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
2✔
1336
}
1337

1338
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1339
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1340
        eopts := parseOpts(opts)
1✔
1341
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1342
                return ae
×
1343
        }
×
1344

1345
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1346
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1347
        return &ApiError{
1✔
1348
                Code:        e.Code,
1✔
1349
                ErrCode:     e.ErrCode,
1✔
1350
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1351
        }
1✔
1352
}
1353

1354
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1355
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1356
        eopts := parseOpts(opts)
1✔
1357
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1358
                return ae
×
1359
        }
×
1360

1361
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1362
}
1363

1364
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1365
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1366
        eopts := parseOpts(opts)
8✔
1367
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1368
                return ae
×
1369
        }
×
1370

1371
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1372
}
1373

1374
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1375
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
3✔
1376
        eopts := parseOpts(opts)
3✔
1377
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1378
                return ae
×
1379
        }
×
1380

1381
        return ApiErrors[JSConsumerNameExistErr]
3✔
1382
}
1383

1384
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1385
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1386
        eopts := parseOpts(opts)
×
1387
        if ae, ok := eopts.err.(*ApiError); ok {
×
1388
                return ae
×
1389
        }
×
1390

1391
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1392
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1393
        return &ApiError{
×
1394
                Code:        e.Code,
×
1395
                ErrCode:     e.ErrCode,
×
1396
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1397
        }
×
1398
}
1399

1400
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1401
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,748✔
1402
        eopts := parseOpts(opts)
2,748✔
1403
        if ae, ok := eopts.err.(*ApiError); ok {
2,748✔
1404
                return ae
×
1405
        }
×
1406

1407
        return ApiErrors[JSConsumerNotFoundErr]
2,748✔
1408
}
1409

1410
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1411
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1412
        eopts := parseOpts(opts)
6✔
1413
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1414
                return ae
×
1415
        }
×
1416

1417
        return ApiErrors[JSConsumerOfflineErr]
6✔
1418
}
1419

1420
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1421
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1422
        eopts := parseOpts(opts)
×
1423
        if ae, ok := eopts.err.(*ApiError); ok {
×
1424
                return ae
×
1425
        }
×
1426

1427
        return ApiErrors[JSConsumerOnMappedErr]
×
1428
}
1429

1430
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1431
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1432
        eopts := parseOpts(opts)
1✔
1433
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1434
                return ae
×
1435
        }
×
1436

1437
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1438
}
1439

1440
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1441
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1442
        eopts := parseOpts(opts)
4✔
1443
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1444
                return ae
×
1445
        }
×
1446

1447
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1448
}
1449

1450
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1451
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1452
        eopts := parseOpts(opts)
×
1453
        if ae, ok := eopts.err.(*ApiError); ok {
×
1454
                return ae
×
1455
        }
×
1456

1457
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1458
}
1459

1460
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1461
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1462
        eopts := parseOpts(opts)
6✔
1463
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1464
                return ae
×
1465
        }
×
1466

1467
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1468
}
1469

1470
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1471
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1472
        eopts := parseOpts(opts)
1✔
1473
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1474
                return ae
×
1475
        }
×
1476

1477
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1478
}
1479

1480
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1481
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1482
        eopts := parseOpts(opts)
3✔
1483
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1484
                return ae
×
1485
        }
×
1486

1487
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1488
}
1489

1490
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1491
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1492
        eopts := parseOpts(opts)
1✔
1493
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1494
                return ae
×
1495
        }
×
1496

1497
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1498
}
1499

1500
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1501
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1502
        eopts := parseOpts(opts)
×
1503
        if ae, ok := eopts.err.(*ApiError); ok {
×
1504
                return ae
×
1505
        }
×
1506

1507
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1508
}
1509

1510
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1511
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1512
        eopts := parseOpts(opts)
1✔
1513
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1514
                return ae
×
1515
        }
×
1516

1517
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1518
}
1519

1520
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1521
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1522
        eopts := parseOpts(opts)
2✔
1523
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1524
                return ae
×
1525
        }
×
1526

1527
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1528
}
1529

1530
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1531
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1532
        eopts := parseOpts(opts)
1✔
1533
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1534
                return ae
×
1535
        }
×
1536

1537
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1538
}
1539

1540
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1541
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
10✔
1542
        eopts := parseOpts(opts)
10✔
1543
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1544
                return ae
×
1545
        }
×
1546

1547
        e := ApiErrors[JSConsumerStoreFailedErrF]
10✔
1548
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1549
        return &ApiError{
10✔
1550
                Code:        e.Code,
10✔
1551
                ErrCode:     e.ErrCode,
10✔
1552
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1553
        }
10✔
1554
}
1555

1556
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1557
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1558
        eopts := parseOpts(opts)
×
1559
        if ae, ok := eopts.err.(*ApiError); ok {
×
1560
                return ae
×
1561
        }
×
1562

1563
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1564
}
1565

1566
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1567
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1568
        eopts := parseOpts(opts)
11✔
1569
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1570
                return ae
×
1571
        }
×
1572

1573
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1574
}
1575

1576
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1577
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1578
        eopts := parseOpts(opts)
2✔
1579
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1580
                return ae
×
1581
        }
×
1582

1583
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1584
}
1585

1586
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1587
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1588
        eopts := parseOpts(opts)
×
1589
        if ae, ok := eopts.err.(*ApiError); ok {
×
1590
                return ae
×
1591
        }
×
1592

1593
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1594
}
1595

1596
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1597
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1598
        eopts := parseOpts(opts)
4✔
1599
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1600
                return ae
×
1601
        }
×
1602

1603
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1604
}
1605

1606
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1607
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
10✔
1608
        eopts := parseOpts(opts)
10✔
1609
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1610
                return ae
×
1611
        }
×
1612

1613
        return ApiErrors[JSInsufficientResourcesErr]
10✔
1614
}
1615

1616
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1617
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1618
        eopts := parseOpts(opts)
10✔
1619
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1620
                return ae
×
1621
        }
×
1622

1623
        e := ApiErrors[JSInvalidJSONErr]
10✔
1624
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1625
        return &ApiError{
10✔
1626
                Code:        e.Code,
10✔
1627
                ErrCode:     e.ErrCode,
10✔
1628
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1629
        }
10✔
1630
}
1631

1632
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1633
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
28✔
1634
        eopts := parseOpts(opts)
28✔
1635
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
1636
                return ae
×
1637
        }
×
1638

1639
        return ApiErrors[JSMaximumConsumersLimitErr]
28✔
1640
}
1641

1642
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1643
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1644
        eopts := parseOpts(opts)
16✔
1645
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1646
                return ae
×
1647
        }
×
1648

1649
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1650
}
1651

1652
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1653
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1654
        eopts := parseOpts(opts)
4✔
1655
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1656
                return ae
×
1657
        }
×
1658

1659
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1660
}
1661

1662
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1663
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1664
        eopts := parseOpts(opts)
4✔
1665
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1666
                return ae
×
1667
        }
×
1668

1669
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1670
}
1671

1672
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1673
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1674
        eopts := parseOpts(opts)
4✔
1675
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1676
                return ae
×
1677
        }
×
1678

1679
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1680
}
1681

1682
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1683
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1684
        eopts := parseOpts(opts)
24✔
1685
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1686
                return ae
×
1687
        }
×
1688

1689
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1690
}
1691

1692
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1693
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1694
        eopts := parseOpts(opts)
8✔
1695
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1696
                return ae
×
1697
        }
×
1698

1699
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1700
}
1701

1702
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1703
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1704
        eopts := parseOpts(opts)
4✔
1705
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1706
                return ae
×
1707
        }
×
1708

1709
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1710
}
1711

1712
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1713
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
7✔
1714
        eopts := parseOpts(opts)
7✔
1715
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
1716
                return ae
×
1717
        }
×
1718

1719
        return ApiErrors[JSMessageTTLDisabledErr]
7✔
1720
}
1721

1722
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1723
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
18✔
1724
        eopts := parseOpts(opts)
18✔
1725
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
1726
                return ae
×
1727
        }
×
1728

1729
        return ApiErrors[JSMessageTTLInvalidErr]
18✔
1730
}
1731

1732
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1733
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1734
        eopts := parseOpts(opts)
×
1735
        if ae, ok := eopts.err.(*ApiError); ok {
×
1736
                return ae
×
1737
        }
×
1738

1739
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1740
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1741
        return &ApiError{
×
1742
                Code:        e.Code,
×
1743
                ErrCode:     e.ErrCode,
×
1744
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1745
        }
×
1746
}
1747

1748
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1749
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1750
        eopts := parseOpts(opts)
×
1751
        if ae, ok := eopts.err.(*ApiError); ok {
×
1752
                return ae
×
1753
        }
×
1754

1755
        return ApiErrors[JSMirrorInvalidStreamName]
×
1756
}
1757

1758
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1759
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1760
        eopts := parseOpts(opts)
2✔
1761
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1762
                return ae
×
1763
        }
×
1764

1765
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
1766
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1767
        return &ApiError{
2✔
1768
                Code:        e.Code,
2✔
1769
                ErrCode:     e.ErrCode,
2✔
1770
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1771
        }
2✔
1772
}
1773

1774
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1775
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1776
        eopts := parseOpts(opts)
2✔
1777
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1778
                return ae
×
1779
        }
×
1780

1781
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
1782
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1783
        return &ApiError{
2✔
1784
                Code:        e.Code,
2✔
1785
                ErrCode:     e.ErrCode,
2✔
1786
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1787
        }
2✔
1788
}
1789

1790
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
1791
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1792
        eopts := parseOpts(opts)
×
1793
        if ae, ok := eopts.err.(*ApiError); ok {
×
1794
                return ae
×
1795
        }
×
1796

1797
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1798
}
1799

1800
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
1801
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1802
        eopts := parseOpts(opts)
1✔
1803
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1804
                return ae
×
1805
        }
×
1806

1807
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1808
}
1809

1810
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
1811
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
1812
        eopts := parseOpts(opts)
2✔
1813
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1814
                return ae
×
1815
        }
×
1816

1817
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
1818
}
1819

1820
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
1821
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
1822
        eopts := parseOpts(opts)
4✔
1823
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1824
                return ae
×
1825
        }
×
1826

1827
        return ApiErrors[JSMirrorWithCountersErr]
4✔
1828
}
1829

1830
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
1831
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
1832
        eopts := parseOpts(opts)
2✔
1833
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1834
                return ae
×
1835
        }
×
1836

1837
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
1838
}
1839

1840
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
1841
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
1842
        eopts := parseOpts(opts)
×
1843
        if ae, ok := eopts.err.(*ApiError); ok {
×
1844
                return ae
×
1845
        }
×
1846

1847
        return ApiErrors[JSMirrorWithSourcesErr]
×
1848
}
1849

1850
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
1851
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
1852
        eopts := parseOpts(opts)
×
1853
        if ae, ok := eopts.err.(*ApiError); ok {
×
1854
                return ae
×
1855
        }
×
1856

1857
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
1858
}
1859

1860
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
1861
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
1862
        eopts := parseOpts(opts)
×
1863
        if ae, ok := eopts.err.(*ApiError); ok {
×
1864
                return ae
×
1865
        }
×
1866

1867
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
1868
}
1869

1870
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
1871
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
1872
        eopts := parseOpts(opts)
2✔
1873
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1874
                return ae
×
1875
        }
×
1876

1877
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
1878
}
1879

1880
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
1881
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
1882
        eopts := parseOpts(opts)
1✔
1883
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1884
                return ae
×
1885
        }
×
1886

1887
        return ApiErrors[JSNoAccountErr]
1✔
1888
}
1889

1890
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
1891
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
1892
        eopts := parseOpts(opts)
4✔
1893
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1894
                return ae
×
1895
        }
×
1896

1897
        return ApiErrors[JSNoLimitsErr]
4✔
1898
}
1899

1900
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
1901
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
462✔
1902
        eopts := parseOpts(opts)
462✔
1903
        if ae, ok := eopts.err.(*ApiError); ok {
462✔
1904
                return ae
×
1905
        }
×
1906

1907
        return ApiErrors[JSNoMessageFoundErr]
462✔
1908
}
1909

1910
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
1911
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
1912
        eopts := parseOpts(opts)
3✔
1913
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1914
                return ae
×
1915
        }
×
1916

1917
        return ApiErrors[JSNotEmptyRequestErr]
3✔
1918
}
1919

1920
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
1921
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
1922
        eopts := parseOpts(opts)
10✔
1923
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1924
                return ae
×
1925
        }
×
1926

1927
        return ApiErrors[JSNotEnabledErr]
10✔
1928
}
1929

1930
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
1931
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
349✔
1932
        eopts := parseOpts(opts)
349✔
1933
        if ae, ok := eopts.err.(*ApiError); ok {
349✔
1934
                return ae
×
1935
        }
×
1936

1937
        return ApiErrors[JSNotEnabledForAccountErr]
349✔
1938
}
1939

1940
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
1941
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
8✔
1942
        eopts := parseOpts(opts)
8✔
1943
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1944
                return ae
×
1945
        }
×
1946

1947
        e := ApiErrors[JSPedanticErrF]
8✔
1948
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1949
        return &ApiError{
8✔
1950
                Code:        e.Code,
8✔
1951
                ErrCode:     e.ErrCode,
8✔
1952
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1953
        }
8✔
1954
}
1955

1956
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
1957
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
1958
        eopts := parseOpts(opts)
5✔
1959
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1960
                return ae
1✔
1961
        }
1✔
1962

1963
        return ApiErrors[JSPeerRemapErr]
4✔
1964
}
1965

1966
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
1967
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
1968
        eopts := parseOpts(opts)
×
1969
        if ae, ok := eopts.err.(*ApiError); ok {
×
1970
                return ae
×
1971
        }
×
1972

1973
        e := ApiErrors[JSRaftGeneralErrF]
×
1974
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1975
        return &ApiError{
×
1976
                Code:        e.Code,
×
1977
                ErrCode:     e.ErrCode,
×
1978
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1979
        }
×
1980
}
1981

1982
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
1983
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
1984
        eopts := parseOpts(opts)
16✔
1985
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1986
                return ae
×
1987
        }
×
1988

1989
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
1990
}
1991

1992
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
1993
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
1994
        eopts := parseOpts(opts)
1✔
1995
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1996
                return ae
×
1997
        }
×
1998

1999
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2000
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2001
        return &ApiError{
1✔
2002
                Code:        e.Code,
1✔
2003
                ErrCode:     e.ErrCode,
1✔
2004
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2005
        }
1✔
2006
}
2007

2008
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2009
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
2010
        eopts := parseOpts(opts)
×
2011
        if ae, ok := eopts.err.(*ApiError); ok {
×
2012
                return ae
×
2013
        }
×
2014

2015
        e := ApiErrors[JSSequenceNotFoundErrF]
×
2016
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
×
2017
        return &ApiError{
×
2018
                Code:        e.Code,
×
2019
                ErrCode:     e.ErrCode,
×
2020
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2021
        }
×
2022
}
2023

2024
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2025
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2026
        eopts := parseOpts(opts)
1✔
2027
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2028
                return ae
×
2029
        }
×
2030

2031
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2032
}
2033

2034
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2035
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2036
        eopts := parseOpts(opts)
×
2037
        if ae, ok := eopts.err.(*ApiError); ok {
×
2038
                return ae
×
2039
        }
×
2040

2041
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2042
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2043
        return &ApiError{
×
2044
                Code:        e.Code,
×
2045
                ErrCode:     e.ErrCode,
×
2046
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2047
        }
×
2048
}
2049

2050
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2051
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2052
        eopts := parseOpts(opts)
×
2053
        if ae, ok := eopts.err.(*ApiError); ok {
×
2054
                return ae
×
2055
        }
×
2056

2057
        return ApiErrors[JSSourceDuplicateDetected]
×
2058
}
2059

2060
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2061
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2062
        eopts := parseOpts(opts)
1✔
2063
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2064
                return ae
×
2065
        }
×
2066

2067
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2068
}
2069

2070
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2071
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2072
        eopts := parseOpts(opts)
1✔
2073
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2074
                return ae
×
2075
        }
×
2076

2077
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
2078
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2079
        return &ApiError{
1✔
2080
                Code:        e.Code,
1✔
2081
                ErrCode:     e.ErrCode,
1✔
2082
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2083
        }
1✔
2084
}
2085

2086
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2087
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2088
        eopts := parseOpts(opts)
1✔
2089
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2090
                return ae
×
2091
        }
×
2092

2093
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2094
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2095
        return &ApiError{
1✔
2096
                Code:        e.Code,
1✔
2097
                ErrCode:     e.ErrCode,
1✔
2098
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2099
        }
1✔
2100
}
2101

2102
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2103
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2104
        eopts := parseOpts(opts)
×
2105
        if ae, ok := eopts.err.(*ApiError); ok {
×
2106
                return ae
×
2107
        }
×
2108

2109
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2110
}
2111

2112
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2113
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2114
        eopts := parseOpts(opts)
×
2115
        if ae, ok := eopts.err.(*ApiError); ok {
×
2116
                return ae
×
2117
        }
×
2118

2119
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2120
}
2121

2122
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2123
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2124
        eopts := parseOpts(opts)
×
2125
        if ae, ok := eopts.err.(*ApiError); ok {
×
2126
                return ae
×
2127
        }
×
2128

2129
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2130
}
2131

2132
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2133
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2134
        eopts := parseOpts(opts)
25✔
2135
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2136
                return ae
×
2137
        }
×
2138

2139
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2140
}
2141

2142
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2143
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2144
        eopts := parseOpts(opts)
×
2145
        if ae, ok := eopts.err.(*ApiError); ok {
×
2146
                return ae
×
2147
        }
×
2148

2149
        e := ApiErrors[JSStreamAssignmentErrF]
×
2150
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2151
        return &ApiError{
×
2152
                Code:        e.Code,
×
2153
                ErrCode:     e.ErrCode,
×
2154
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2155
        }
×
2156
}
2157

2158
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2159
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
77✔
2160
        eopts := parseOpts(opts)
77✔
2161
        if ae, ok := eopts.err.(*ApiError); ok {
154✔
2162
                return ae
77✔
2163
        }
77✔
2164

2165
        e := ApiErrors[JSStreamCreateErrF]
×
2166
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2167
        return &ApiError{
×
2168
                Code:        e.Code,
×
2169
                ErrCode:     e.ErrCode,
×
2170
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2171
        }
×
2172
}
2173

2174
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2175
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2176
        eopts := parseOpts(opts)
×
2177
        if ae, ok := eopts.err.(*ApiError); ok {
×
2178
                return ae
×
2179
        }
×
2180

2181
        e := ApiErrors[JSStreamDeleteErrF]
×
2182
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2183
        return &ApiError{
×
2184
                Code:        e.Code,
×
2185
                ErrCode:     e.ErrCode,
×
2186
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2187
        }
×
2188
}
2189

2190
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2191
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
12✔
2192
        eopts := parseOpts(opts)
12✔
2193
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
2194
                return ae
×
2195
        }
×
2196

2197
        return ApiErrors[JSStreamDuplicateMessageConflict]
12✔
2198
}
2199

2200
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2201
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2202
        eopts := parseOpts(opts)
×
2203
        if ae, ok := eopts.err.(*ApiError); ok {
×
2204
                return ae
×
2205
        }
×
2206

2207
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2208
}
2209

2210
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2211
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2212
        eopts := parseOpts(opts)
2✔
2213
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2214
                return ae
×
2215
        }
×
2216

2217
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2218
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2219
        return &ApiError{
2✔
2220
                Code:        e.Code,
2✔
2221
                ErrCode:     e.ErrCode,
2✔
2222
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2223
        }
2✔
2224
}
2225

2226
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2227
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2228
        eopts := parseOpts(opts)
×
2229
        if ae, ok := eopts.err.(*ApiError); ok {
×
2230
                return ae
×
2231
        }
×
2232

2233
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2234
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2235
        return &ApiError{
×
2236
                Code:        e.Code,
×
2237
                ErrCode:     e.ErrCode,
×
2238
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2239
        }
×
2240
}
2241

2242
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2243
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2244
        eopts := parseOpts(opts)
3✔
2245
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2246
                return ae
×
2247
        }
×
2248

2249
        e := ApiErrors[JSStreamGeneralErrorF]
3✔
2250
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2251
        return &ApiError{
3✔
2252
                Code:        e.Code,
3✔
2253
                ErrCode:     e.ErrCode,
3✔
2254
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2255
        }
3✔
2256
}
2257

2258
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2259
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2260
        eopts := parseOpts(opts)
1✔
2261
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2262
                return ae
×
2263
        }
×
2264

2265
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2266
}
2267

2268
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2269
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2270
        eopts := parseOpts(opts)
×
2271
        if ae, ok := eopts.err.(*ApiError); ok {
×
2272
                return ae
×
2273
        }
×
2274

2275
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2276
}
2277

2278
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2279
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
139✔
2280
        eopts := parseOpts(opts)
139✔
2281
        if ae, ok := eopts.err.(*ApiError); ok {
162✔
2282
                return ae
23✔
2283
        }
23✔
2284

2285
        e := ApiErrors[JSStreamInvalidConfigF]
116✔
2286
        args := e.toReplacerArgs([]interface{}{"{err}", err})
116✔
2287
        return &ApiError{
116✔
2288
                Code:        e.Code,
116✔
2289
                ErrCode:     e.ErrCode,
116✔
2290
                Description: strings.NewReplacer(args...).Replace(e.Description),
116✔
2291
        }
116✔
2292
}
2293

2294
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2295
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2296
        eopts := parseOpts(opts)
×
2297
        if ae, ok := eopts.err.(*ApiError); ok {
×
2298
                return ae
×
2299
        }
×
2300

2301
        return ApiErrors[JSStreamInvalidErr]
×
2302
}
2303

2304
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2305
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2306
        eopts := parseOpts(opts)
×
2307
        if ae, ok := eopts.err.(*ApiError); ok {
×
2308
                return ae
×
2309
        }
×
2310

2311
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2312
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2313
        return &ApiError{
×
2314
                Code:        e.Code,
×
2315
                ErrCode:     e.ErrCode,
×
2316
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2317
        }
×
2318
}
2319

2320
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2321
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2322
        eopts := parseOpts(opts)
8✔
2323
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2324
                return ae
8✔
2325
        }
8✔
2326

2327
        e := ApiErrors[JSStreamLimitsErrF]
×
2328
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2329
        return &ApiError{
×
2330
                Code:        e.Code,
×
2331
                ErrCode:     e.ErrCode,
×
2332
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2333
        }
×
2334
}
2335

2336
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2337
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2338
        eopts := parseOpts(opts)
3✔
2339
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2340
                return ae
×
2341
        }
×
2342

2343
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2344
}
2345

2346
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2347
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2348
        eopts := parseOpts(opts)
2✔
2349
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2350
                return ae
×
2351
        }
×
2352

2353
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2354
}
2355

2356
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2357
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
15✔
2358
        eopts := parseOpts(opts)
15✔
2359
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2360
                return ae
×
2361
        }
×
2362

2363
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
15✔
2364
}
2365

2366
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2367
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
4✔
2368
        eopts := parseOpts(opts)
4✔
2369
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2370
                return ae
×
2371
        }
×
2372

2373
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
2374
}
2375

2376
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2377
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2378
        eopts := parseOpts(opts)
3✔
2379
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2380
                return ae
×
2381
        }
×
2382

2383
        return ApiErrors[JSStreamMismatchErr]
3✔
2384
}
2385

2386
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2387
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2388
        eopts := parseOpts(opts)
4✔
2389
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2390
                return ae
×
2391
        }
×
2392

2393
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2394
}
2395

2396
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2397
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2398
        eopts := parseOpts(opts)
2✔
2399
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2400
                return ae
×
2401
        }
×
2402

2403
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2404
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2405
        return &ApiError{
2✔
2406
                Code:        e.Code,
2✔
2407
                ErrCode:     e.ErrCode,
2✔
2408
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2409
        }
2✔
2410
}
2411

2412
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2413
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2414
        eopts := parseOpts(opts)
×
2415
        if ae, ok := eopts.err.(*ApiError); ok {
×
2416
                return ae
×
2417
        }
×
2418

2419
        return ApiErrors[JSStreamMoveNotInProgress]
×
2420
}
2421

2422
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2423
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2424
        eopts := parseOpts(opts)
1✔
2425
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2426
                return ae
×
2427
        }
×
2428

2429
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1✔
2430
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2431
        return &ApiError{
1✔
2432
                Code:        e.Code,
1✔
2433
                ErrCode:     e.ErrCode,
1✔
2434
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2435
        }
1✔
2436
}
2437

2438
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2439
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2440
        eopts := parseOpts(opts)
6✔
2441
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2442
                return ae
×
2443
        }
×
2444

2445
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2446
}
2447

2448
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2449
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
×
2450
        eopts := parseOpts(opts)
×
2451
        if ae, ok := eopts.err.(*ApiError); ok {
×
2452
                return ae
×
2453
        }
×
2454

2455
        return ApiErrors[JSStreamNameExistErr]
×
2456
}
2457

2458
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2459
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2460
        eopts := parseOpts(opts)
3✔
2461
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2462
                return ae
×
2463
        }
×
2464

2465
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2466
}
2467

2468
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2469
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
25,024✔
2470
        eopts := parseOpts(opts)
25,024✔
2471
        if ae, ok := eopts.err.(*ApiError); ok {
25,691✔
2472
                return ae
667✔
2473
        }
667✔
2474

2475
        return ApiErrors[JSStreamNotFoundErr]
24,357✔
2476
}
2477

2478
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2479
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2480
        eopts := parseOpts(opts)
5✔
2481
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2482
                return ae
×
2483
        }
×
2484

2485
        return ApiErrors[JSStreamNotMatchErr]
5✔
2486
}
2487

2488
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2489
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2490
        eopts := parseOpts(opts)
6✔
2491
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2492
                return ae
×
2493
        }
×
2494

2495
        return ApiErrors[JSStreamOfflineErr]
6✔
2496
}
2497

2498
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2499
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2500
        eopts := parseOpts(opts)
1✔
2501
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2502
                return ae
×
2503
        }
×
2504

2505
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2506
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2507
        return &ApiError{
1✔
2508
                Code:        e.Code,
1✔
2509
                ErrCode:     e.ErrCode,
1✔
2510
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2511
        }
1✔
2512
}
2513

2514
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2515
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2516
        eopts := parseOpts(opts)
1✔
2517
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2518
                return ae
×
2519
        }
×
2520

2521
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2522
}
2523

2524
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2525
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2526
        eopts := parseOpts(opts)
×
2527
        if ae, ok := eopts.err.(*ApiError); ok {
×
2528
                return ae
×
2529
        }
×
2530

2531
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2532
}
2533

2534
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2535
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2536
        eopts := parseOpts(opts)
7✔
2537
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2538
                return ae
2✔
2539
        }
2✔
2540

2541
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2542
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2543
        return &ApiError{
5✔
2544
                Code:        e.Code,
5✔
2545
                ErrCode:     e.ErrCode,
5✔
2546
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2547
        }
5✔
2548
}
2549

2550
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2551
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
2552
        eopts := parseOpts(opts)
8✔
2553
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2554
                return ae
×
2555
        }
×
2556

2557
        e := ApiErrors[JSStreamRollupFailedF]
8✔
2558
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
2559
        return &ApiError{
8✔
2560
                Code:        e.Code,
8✔
2561
                ErrCode:     e.ErrCode,
8✔
2562
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
2563
        }
8✔
2564
}
2565

2566
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2567
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2568
        eopts := parseOpts(opts)
10✔
2569
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2570
                return ae
×
2571
        }
×
2572

2573
        return ApiErrors[JSStreamSealedErr]
10✔
2574
}
2575

2576
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2577
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2578
        eopts := parseOpts(opts)
×
2579
        if ae, ok := eopts.err.(*ApiError); ok {
×
2580
                return ae
×
2581
        }
×
2582

2583
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2584
}
2585

2586
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2587
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2588
        eopts := parseOpts(opts)
×
2589
        if ae, ok := eopts.err.(*ApiError); ok {
×
2590
                return ae
×
2591
        }
×
2592

2593
        e := ApiErrors[JSStreamSnapshotErrF]
×
2594
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2595
        return &ApiError{
×
2596
                Code:        e.Code,
×
2597
                ErrCode:     e.ErrCode,
×
2598
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2599
        }
×
2600
}
2601

2602
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2603
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
1,028✔
2604
        eopts := parseOpts(opts)
1,028✔
2605
        if ae, ok := eopts.err.(*ApiError); ok {
1,028✔
2606
                return ae
×
2607
        }
×
2608

2609
        e := ApiErrors[JSStreamStoreFailedF]
1,028✔
2610
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,028✔
2611
        return &ApiError{
1,028✔
2612
                Code:        e.Code,
1,028✔
2613
                ErrCode:     e.ErrCode,
1,028✔
2614
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,028✔
2615
        }
1,028✔
2616
}
2617

2618
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2619
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
39✔
2620
        eopts := parseOpts(opts)
39✔
2621
        if ae, ok := eopts.err.(*ApiError); ok {
39✔
2622
                return ae
×
2623
        }
×
2624

2625
        return ApiErrors[JSStreamSubjectOverlapErr]
39✔
2626
}
2627

2628
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2629
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2630
        eopts := parseOpts(opts)
×
2631
        if ae, ok := eopts.err.(*ApiError); ok {
×
2632
                return ae
×
2633
        }
×
2634

2635
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
2636
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2637
        return &ApiError{
×
2638
                Code:        e.Code,
×
2639
                ErrCode:     e.ErrCode,
×
2640
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2641
        }
×
2642
}
2643

2644
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2645
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2646
        eopts := parseOpts(opts)
1✔
2647
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2648
                return ae
1✔
2649
        }
1✔
2650

2651
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2652
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2653
        return &ApiError{
×
2654
                Code:        e.Code,
×
2655
                ErrCode:     e.ErrCode,
×
2656
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2657
        }
×
2658
}
2659

2660
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2661
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2662
        eopts := parseOpts(opts)
4✔
2663
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2664
                return ae
×
2665
        }
×
2666

2667
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2668
}
2669

2670
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2671
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
182✔
2672
        eopts := parseOpts(opts)
182✔
2673
        if ae, ok := eopts.err.(*ApiError); ok {
182✔
2674
                return ae
×
2675
        }
×
2676

2677
        return ApiErrors[JSStreamTooManyRequests]
182✔
2678
}
2679

2680
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
2681
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2682
        eopts := parseOpts(opts)
1✔
2683
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2684
                return ae
×
2685
        }
×
2686

2687
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
2688
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2689
        return &ApiError{
1✔
2690
                Code:        e.Code,
1✔
2691
                ErrCode:     e.ErrCode,
1✔
2692
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2693
        }
1✔
2694
}
2695

2696
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2697
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2698
        eopts := parseOpts(opts)
1✔
2699
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2700
                return ae
×
2701
        }
×
2702

2703
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
2704
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2705
        return &ApiError{
1✔
2706
                Code:        e.Code,
1✔
2707
                ErrCode:     e.ErrCode,
1✔
2708
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2709
        }
1✔
2710
}
2711

2712
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2713
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
23✔
2714
        eopts := parseOpts(opts)
23✔
2715
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2716
                return ae
17✔
2717
        }
17✔
2718

2719
        e := ApiErrors[JSStreamUpdateErrF]
6✔
2720
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
2721
        return &ApiError{
6✔
2722
                Code:        e.Code,
6✔
2723
                ErrCode:     e.ErrCode,
6✔
2724
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
2725
        }
6✔
2726
}
2727

2728
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2729
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2730
        eopts := parseOpts(opts)
5✔
2731
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2732
                return ae
×
2733
        }
×
2734

2735
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
2736
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
2737
        return &ApiError{
5✔
2738
                Code:        e.Code,
5✔
2739
                ErrCode:     e.ErrCode,
5✔
2740
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2741
        }
5✔
2742
}
2743

2744
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
2745
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
10✔
2746
        eopts := parseOpts(opts)
10✔
2747
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2748
                return ae
×
2749
        }
×
2750

2751
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
10✔
2752
}
2753

2754
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
2755
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
58✔
2756
        eopts := parseOpts(opts)
58✔
2757
        if ae, ok := eopts.err.(*ApiError); ok {
58✔
2758
                return ae
×
2759
        }
×
2760

2761
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
58✔
2762
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
58✔
2763
        return &ApiError{
58✔
2764
                Code:        e.Code,
58✔
2765
                ErrCode:     e.ErrCode,
58✔
2766
                Description: strings.NewReplacer(args...).Replace(e.Description),
58✔
2767
        }
58✔
2768
}
2769

2770
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
2771
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
2772
        eopts := parseOpts(opts)
×
2773
        if ae, ok := eopts.err.(*ApiError); ok {
×
2774
                return ae
×
2775
        }
×
2776

2777
        return ApiErrors[JSTempStorageFailedErr]
×
2778
}
2779

2780
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
2781
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
2782
        eopts := parseOpts(opts)
1✔
2783
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2784
                return ae
×
2785
        }
×
2786

2787
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
1✔
2788
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc