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

nats-io / nats-server / 16435002168

21 Jul 2025 04:05PM UTC coverage: 85.791% (+0.06%) from 85.736%
16435002168

push

github

web-flow
(2.12) Stream leader should propose consumer remaps once assignment processed (#7071)

Right now, in a stream scale up/scale down scenario where there are
consumers that also need to be scaled, the metaleader makes a proposal
to update the stream and then immediately makes proposals to update the
consumers. However, this does not account for the fact that the stream
proposal _could_ fail to be applied, which is where we have sometimes
seen peer set drifts.

This moves this logic to take place on the stream leader once the stream
update proposal is applied instead.

This will also be necessary in a world where the consumer assignments
are managed by the stream leader, as the metaleader will not know
anything about the stream NRG.

Signed-off-by: Neil Twigg <neil@nats.io>

71148 of 82932 relevant lines covered (85.79%)

344990.82 hits per line

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

53.6
/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
        // JSAtomicPublishDuplicateErr atomic publish duplicates not allowed
15
        JSAtomicPublishDuplicateErr ErrorIdentifier = 10177
16

17
        // JSAtomicPublishIncompleteBatchErr atomic publish batch is incomplete
18
        JSAtomicPublishIncompleteBatchErr ErrorIdentifier = 10176
19

20
        // JSAtomicPublishMissingSeqErr atomic publish sequence is missing
21
        JSAtomicPublishMissingSeqErr ErrorIdentifier = 10175
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
                JSAtomicPublishDuplicateErr:                {Code: 400, ErrCode: 10177, Description: "atomic publish duplicates not allowed"},
545
                JSAtomicPublishIncompleteBatchErr:          {Code: 400, ErrCode: 10176, Description: "atomic publish batch is incomplete"},
546
                JSAtomicPublishMissingSeqErr:               {Code: 400, ErrCode: 10175, Description: "atomic publish sequence is missing"},
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,059✔
746
        eopts := parseOpts(opts)
20,059✔
747
        if ae, ok := eopts.err.(*ApiError); ok {
20,059✔
748
                return ae
×
749
        }
×
750

751
        return ApiErrors[JSAccountResourcesExceededErr]
20,059✔
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
// NewJSAtomicPublishDuplicateError creates a new JSAtomicPublishDuplicateErr error: "atomic publish duplicates not allowed"
765
func NewJSAtomicPublishDuplicateError(opts ...ErrorOption) *ApiError {
12✔
766
        eopts := parseOpts(opts)
12✔
767
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
768
                return ae
×
769
        }
×
770

771
        return ApiErrors[JSAtomicPublishDuplicateErr]
12✔
772
}
773

774
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
775
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
24✔
776
        eopts := parseOpts(opts)
24✔
777
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
778
                return ae
×
779
        }
×
780

781
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
24✔
782
}
783

784
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
785
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
12✔
786
        eopts := parseOpts(opts)
12✔
787
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
788
                return ae
×
789
        }
×
790

791
        return ApiErrors[JSAtomicPublishMissingSeqErr]
12✔
792
}
793

794
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
795
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
796
        eopts := parseOpts(opts)
10✔
797
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
798
                return ae
×
799
        }
×
800

801
        return ApiErrors[JSBadRequestErr]
10✔
802
}
803

804
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
805
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
806
        eopts := parseOpts(opts)
×
807
        if ae, ok := eopts.err.(*ApiError); ok {
×
808
                return ae
×
809
        }
×
810

811
        return ApiErrors[JSClusterIncompleteErr]
×
812
}
813

814
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
815
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
58✔
816
        eopts := parseOpts(opts)
58✔
817
        if ae, ok := eopts.err.(*ApiError); ok {
58✔
818
                return ae
×
819
        }
×
820

821
        e := ApiErrors[JSClusterNoPeersErrF]
58✔
822
        args := e.toReplacerArgs([]interface{}{"{err}", err})
58✔
823
        return &ApiError{
58✔
824
                Code:        e.Code,
58✔
825
                ErrCode:     e.ErrCode,
58✔
826
                Description: strings.NewReplacer(args...).Replace(e.Description),
58✔
827
        }
58✔
828
}
829

830
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
831
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
832
        eopts := parseOpts(opts)
1✔
833
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
834
                return ae
×
835
        }
×
836

837
        return ApiErrors[JSClusterNotActiveErr]
1✔
838
}
839

840
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
841
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
20✔
842
        eopts := parseOpts(opts)
20✔
843
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
844
                return ae
×
845
        }
×
846

847
        return ApiErrors[JSClusterNotAssignedErr]
20✔
848
}
849

850
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
851
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
852
        eopts := parseOpts(opts)
13✔
853
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
854
                return ae
×
855
        }
×
856

857
        return ApiErrors[JSClusterNotAvailErr]
13✔
858
}
859

860
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
861
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
60✔
862
        eopts := parseOpts(opts)
60✔
863
        if ae, ok := eopts.err.(*ApiError); ok {
60✔
864
                return ae
×
865
        }
×
866

867
        return ApiErrors[JSClusterNotLeaderErr]
60✔
868
}
869

870
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
871
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
872
        eopts := parseOpts(opts)
1✔
873
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
874
                return ae
×
875
        }
×
876

877
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
878
}
879

880
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
881
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
882
        eopts := parseOpts(opts)
×
883
        if ae, ok := eopts.err.(*ApiError); ok {
×
884
                return ae
×
885
        }
×
886

887
        return ApiErrors[JSClusterRequiredErr]
×
888
}
889

890
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
891
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
892
        eopts := parseOpts(opts)
3✔
893
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
894
                return ae
×
895
        }
×
896

897
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
898
}
899

900
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
901
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
902
        eopts := parseOpts(opts)
×
903
        if ae, ok := eopts.err.(*ApiError); ok {
×
904
                return ae
×
905
        }
×
906

907
        return ApiErrors[JSClusterTagsErr]
×
908
}
909

910
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
911
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
912
        eopts := parseOpts(opts)
6✔
913
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
914
                return ae
×
915
        }
×
916

917
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
918
}
919

920
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
921
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
922
        eopts := parseOpts(opts)
5✔
923
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
924
                return ae
×
925
        }
×
926

927
        return ApiErrors[JSConsumerAlreadyExists]
5✔
928
}
929

930
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
931
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
932
        eopts := parseOpts(opts)
×
933
        if ae, ok := eopts.err.(*ApiError); ok {
×
934
                return ae
×
935
        }
×
936

937
        return ApiErrors[JSConsumerBadDurableNameErr]
×
938
}
939

940
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
941
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
942
        eopts := parseOpts(opts)
2✔
943
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
944
                return ae
×
945
        }
×
946

947
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
948
}
949

950
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
951
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
952
        eopts := parseOpts(opts)
1✔
953
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
954
                return ae
×
955
        }
×
956

957
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
958
}
959

960
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
961
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
69✔
962
        eopts := parseOpts(opts)
69✔
963
        if ae, ok := eopts.err.(*ApiError); ok {
120✔
964
                return ae
51✔
965
        }
51✔
966

967
        e := ApiErrors[JSConsumerCreateErrF]
18✔
968
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
969
        return &ApiError{
18✔
970
                Code:        e.Code,
18✔
971
                ErrCode:     e.ErrCode,
18✔
972
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
973
        }
18✔
974
}
975

976
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
977
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
978
        eopts := parseOpts(opts)
2✔
979
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
980
                return ae
×
981
        }
×
982

983
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
984
}
985

986
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
987
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
988
        eopts := parseOpts(opts)
4✔
989
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
990
                return ae
×
991
        }
×
992

993
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
994
}
995

996
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
997
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
998
        eopts := parseOpts(opts)
4✔
999
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1000
                return ae
×
1001
        }
×
1002

1003
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1004
}
1005

1006
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1007
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1008
        eopts := parseOpts(opts)
1✔
1009
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1010
                return ae
×
1011
        }
×
1012

1013
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1014
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1015
        return &ApiError{
1✔
1016
                Code:        e.Code,
1✔
1017
                ErrCode:     e.ErrCode,
1✔
1018
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1019
        }
1✔
1020
}
1021

1022
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1023
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1024
        eopts := parseOpts(opts)
×
1025
        if ae, ok := eopts.err.(*ApiError); ok {
×
1026
                return ae
×
1027
        }
×
1028

1029
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1030
}
1031

1032
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1033
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1034
        eopts := parseOpts(opts)
×
1035
        if ae, ok := eopts.err.(*ApiError); ok {
×
1036
                return ae
×
1037
        }
×
1038

1039
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1040
}
1041

1042
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1043
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1044
        eopts := parseOpts(opts)
3✔
1045
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1046
                return ae
×
1047
        }
×
1048

1049
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1050
}
1051

1052
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1053
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1054
        eopts := parseOpts(opts)
1✔
1055
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1056
                return ae
×
1057
        }
×
1058

1059
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1060
}
1061

1062
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1063
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1064
        eopts := parseOpts(opts)
×
1065
        if ae, ok := eopts.err.(*ApiError); ok {
×
1066
                return ae
×
1067
        }
×
1068

1069
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1070
}
1071

1072
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1073
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1074
        eopts := parseOpts(opts)
×
1075
        if ae, ok := eopts.err.(*ApiError); ok {
×
1076
                return ae
×
1077
        }
×
1078

1079
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1080
}
1081

1082
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1083
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1084
        eopts := parseOpts(opts)
1✔
1085
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1086
                return ae
×
1087
        }
×
1088

1089
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1090
}
1091

1092
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1093
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1094
        eopts := parseOpts(opts)
1✔
1095
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1096
                return ae
×
1097
        }
×
1098

1099
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1100
}
1101

1102
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1103
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1104
        eopts := parseOpts(opts)
4✔
1105
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1106
                return ae
×
1107
        }
×
1108

1109
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1110
}
1111

1112
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1113
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1114
        eopts := parseOpts(opts)
×
1115
        if ae, ok := eopts.err.(*ApiError); ok {
×
1116
                return ae
×
1117
        }
×
1118

1119
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1120
}
1121

1122
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1123
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1124
        eopts := parseOpts(opts)
3✔
1125
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1126
                return ae
×
1127
        }
×
1128

1129
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1130
}
1131

1132
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1133
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1134
        eopts := parseOpts(opts)
×
1135
        if ae, ok := eopts.err.(*ApiError); ok {
×
1136
                return ae
×
1137
        }
×
1138

1139
        return ApiErrors[JSConsumerExistingActiveErr]
×
1140
}
1141

1142
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1143
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1144
        eopts := parseOpts(opts)
×
1145
        if ae, ok := eopts.err.(*ApiError); ok {
×
1146
                return ae
×
1147
        }
×
1148

1149
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1150
}
1151

1152
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1153
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1154
        eopts := parseOpts(opts)
×
1155
        if ae, ok := eopts.err.(*ApiError); ok {
×
1156
                return ae
×
1157
        }
×
1158

1159
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1160
}
1161

1162
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1163
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1164
        eopts := parseOpts(opts)
×
1165
        if ae, ok := eopts.err.(*ApiError); ok {
×
1166
                return ae
×
1167
        }
×
1168

1169
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1170
}
1171

1172
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1173
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1174
        eopts := parseOpts(opts)
2✔
1175
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1176
                return ae
×
1177
        }
×
1178

1179
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1180
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1181
        return &ApiError{
2✔
1182
                Code:        e.Code,
2✔
1183
                ErrCode:     e.ErrCode,
2✔
1184
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1185
        }
2✔
1186
}
1187

1188
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1189
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1190
        eopts := parseOpts(opts)
2✔
1191
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1192
                return ae
×
1193
        }
×
1194

1195
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1196
}
1197

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

1205
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1206
}
1207

1208
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1209
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1210
        eopts := parseOpts(opts)
10✔
1211
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1212
                return ae
×
1213
        }
×
1214

1215
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1216
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1217
        return &ApiError{
10✔
1218
                Code:        e.Code,
10✔
1219
                ErrCode:     e.ErrCode,
10✔
1220
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1221
        }
10✔
1222
}
1223

1224
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1225
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1226
        eopts := parseOpts(opts)
2✔
1227
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1228
                return ae
×
1229
        }
×
1230

1231
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1232
}
1233

1234
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1235
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1236
        eopts := parseOpts(opts)
×
1237
        if ae, ok := eopts.err.(*ApiError); ok {
×
1238
                return ae
×
1239
        }
×
1240

1241
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1242
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1243
        return &ApiError{
×
1244
                Code:        e.Code,
×
1245
                ErrCode:     e.ErrCode,
×
1246
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1247
        }
×
1248
}
1249

1250
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1251
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1252
        eopts := parseOpts(opts)
3✔
1253
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1254
                return ae
×
1255
        }
×
1256

1257
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1258
}
1259

1260
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1261
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1262
        eopts := parseOpts(opts)
12✔
1263
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1264
                return ae
×
1265
        }
×
1266

1267
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1268
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1269
        return &ApiError{
12✔
1270
                Code:        e.Code,
12✔
1271
                ErrCode:     e.ErrCode,
12✔
1272
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1273
        }
12✔
1274
}
1275

1276
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1277
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1278
        eopts := parseOpts(opts)
2✔
1279
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1280
                return ae
×
1281
        }
×
1282

1283
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1284
}
1285

1286
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1287
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1288
        eopts := parseOpts(opts)
4✔
1289
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1290
                return ae
×
1291
        }
×
1292

1293
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1294
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1295
        return &ApiError{
4✔
1296
                Code:        e.Code,
4✔
1297
                ErrCode:     e.ErrCode,
4✔
1298
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1299
        }
4✔
1300
}
1301

1302
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1303
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1304
        eopts := parseOpts(opts)
×
1305
        if ae, ok := eopts.err.(*ApiError); ok {
×
1306
                return ae
×
1307
        }
×
1308

1309
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1310
}
1311

1312
// NewJSConsumerMaxRequestExpiresToSmallError creates a new JSConsumerMaxRequestExpiresToSmall error: "consumer max request expires needs to be >= 1ms"
1313
func NewJSConsumerMaxRequestExpiresToSmallError(opts ...ErrorOption) *ApiError {
×
1314
        eopts := parseOpts(opts)
×
1315
        if ae, ok := eopts.err.(*ApiError); ok {
×
1316
                return ae
×
1317
        }
×
1318

1319
        return ApiErrors[JSConsumerMaxRequestExpiresToSmall]
×
1320
}
1321

1322
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1323
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
2✔
1324
        eopts := parseOpts(opts)
2✔
1325
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1326
                return ae
×
1327
        }
×
1328

1329
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
2✔
1330
}
1331

1332
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1333
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1334
        eopts := parseOpts(opts)
1✔
1335
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1336
                return ae
×
1337
        }
×
1338

1339
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1340
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1341
        return &ApiError{
1✔
1342
                Code:        e.Code,
1✔
1343
                ErrCode:     e.ErrCode,
1✔
1344
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1345
        }
1✔
1346
}
1347

1348
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1349
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1350
        eopts := parseOpts(opts)
1✔
1351
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1352
                return ae
×
1353
        }
×
1354

1355
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1356
}
1357

1358
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1359
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1360
        eopts := parseOpts(opts)
8✔
1361
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1362
                return ae
×
1363
        }
×
1364

1365
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1366
}
1367

1368
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1369
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1370
        eopts := parseOpts(opts)
2✔
1371
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1372
                return ae
×
1373
        }
×
1374

1375
        return ApiErrors[JSConsumerNameExistErr]
2✔
1376
}
1377

1378
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1379
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1380
        eopts := parseOpts(opts)
×
1381
        if ae, ok := eopts.err.(*ApiError); ok {
×
1382
                return ae
×
1383
        }
×
1384

1385
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1386
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1387
        return &ApiError{
×
1388
                Code:        e.Code,
×
1389
                ErrCode:     e.ErrCode,
×
1390
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1391
        }
×
1392
}
1393

1394
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1395
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,748✔
1396
        eopts := parseOpts(opts)
2,748✔
1397
        if ae, ok := eopts.err.(*ApiError); ok {
2,748✔
1398
                return ae
×
1399
        }
×
1400

1401
        return ApiErrors[JSConsumerNotFoundErr]
2,748✔
1402
}
1403

1404
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1405
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1406
        eopts := parseOpts(opts)
6✔
1407
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1408
                return ae
×
1409
        }
×
1410

1411
        return ApiErrors[JSConsumerOfflineErr]
6✔
1412
}
1413

1414
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1415
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1416
        eopts := parseOpts(opts)
×
1417
        if ae, ok := eopts.err.(*ApiError); ok {
×
1418
                return ae
×
1419
        }
×
1420

1421
        return ApiErrors[JSConsumerOnMappedErr]
×
1422
}
1423

1424
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1425
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1426
        eopts := parseOpts(opts)
1✔
1427
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1428
                return ae
×
1429
        }
×
1430

1431
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1432
}
1433

1434
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1435
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1436
        eopts := parseOpts(opts)
4✔
1437
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1438
                return ae
×
1439
        }
×
1440

1441
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1442
}
1443

1444
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1445
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1446
        eopts := parseOpts(opts)
×
1447
        if ae, ok := eopts.err.(*ApiError); ok {
×
1448
                return ae
×
1449
        }
×
1450

1451
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1452
}
1453

1454
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1455
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1456
        eopts := parseOpts(opts)
6✔
1457
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1458
                return ae
×
1459
        }
×
1460

1461
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1462
}
1463

1464
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1465
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1466
        eopts := parseOpts(opts)
1✔
1467
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1468
                return ae
×
1469
        }
×
1470

1471
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1472
}
1473

1474
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1475
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1476
        eopts := parseOpts(opts)
3✔
1477
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1478
                return ae
×
1479
        }
×
1480

1481
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1482
}
1483

1484
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1485
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1486
        eopts := parseOpts(opts)
1✔
1487
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1488
                return ae
×
1489
        }
×
1490

1491
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1492
}
1493

1494
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1495
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1496
        eopts := parseOpts(opts)
×
1497
        if ae, ok := eopts.err.(*ApiError); ok {
×
1498
                return ae
×
1499
        }
×
1500

1501
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1502
}
1503

1504
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1505
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1506
        eopts := parseOpts(opts)
1✔
1507
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1508
                return ae
×
1509
        }
×
1510

1511
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1512
}
1513

1514
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1515
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1516
        eopts := parseOpts(opts)
2✔
1517
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1518
                return ae
×
1519
        }
×
1520

1521
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1522
}
1523

1524
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1525
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1526
        eopts := parseOpts(opts)
1✔
1527
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1528
                return ae
×
1529
        }
×
1530

1531
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1532
}
1533

1534
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1535
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
10✔
1536
        eopts := parseOpts(opts)
10✔
1537
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1538
                return ae
×
1539
        }
×
1540

1541
        e := ApiErrors[JSConsumerStoreFailedErrF]
10✔
1542
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1543
        return &ApiError{
10✔
1544
                Code:        e.Code,
10✔
1545
                ErrCode:     e.ErrCode,
10✔
1546
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1547
        }
10✔
1548
}
1549

1550
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1551
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1552
        eopts := parseOpts(opts)
×
1553
        if ae, ok := eopts.err.(*ApiError); ok {
×
1554
                return ae
×
1555
        }
×
1556

1557
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1558
}
1559

1560
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1561
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1562
        eopts := parseOpts(opts)
11✔
1563
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1564
                return ae
×
1565
        }
×
1566

1567
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1568
}
1569

1570
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1571
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1572
        eopts := parseOpts(opts)
2✔
1573
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1574
                return ae
×
1575
        }
×
1576

1577
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1578
}
1579

1580
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1581
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1582
        eopts := parseOpts(opts)
×
1583
        if ae, ok := eopts.err.(*ApiError); ok {
×
1584
                return ae
×
1585
        }
×
1586

1587
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1588
}
1589

1590
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1591
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1592
        eopts := parseOpts(opts)
4✔
1593
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1594
                return ae
×
1595
        }
×
1596

1597
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1598
}
1599

1600
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1601
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
10✔
1602
        eopts := parseOpts(opts)
10✔
1603
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1604
                return ae
×
1605
        }
×
1606

1607
        return ApiErrors[JSInsufficientResourcesErr]
10✔
1608
}
1609

1610
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1611
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1612
        eopts := parseOpts(opts)
10✔
1613
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1614
                return ae
×
1615
        }
×
1616

1617
        e := ApiErrors[JSInvalidJSONErr]
10✔
1618
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1619
        return &ApiError{
10✔
1620
                Code:        e.Code,
10✔
1621
                ErrCode:     e.ErrCode,
10✔
1622
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1623
        }
10✔
1624
}
1625

1626
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1627
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1628
        eopts := parseOpts(opts)
29✔
1629
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1630
                return ae
×
1631
        }
×
1632

1633
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1634
}
1635

1636
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1637
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1638
        eopts := parseOpts(opts)
16✔
1639
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1640
                return ae
×
1641
        }
×
1642

1643
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1644
}
1645

1646
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1647
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1648
        eopts := parseOpts(opts)
4✔
1649
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1650
                return ae
×
1651
        }
×
1652

1653
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1654
}
1655

1656
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1657
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1658
        eopts := parseOpts(opts)
4✔
1659
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1660
                return ae
×
1661
        }
×
1662

1663
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1664
}
1665

1666
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1667
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1668
        eopts := parseOpts(opts)
4✔
1669
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1670
                return ae
×
1671
        }
×
1672

1673
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1674
}
1675

1676
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1677
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1678
        eopts := parseOpts(opts)
24✔
1679
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1680
                return ae
×
1681
        }
×
1682

1683
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1684
}
1685

1686
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1687
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1688
        eopts := parseOpts(opts)
8✔
1689
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1690
                return ae
×
1691
        }
×
1692

1693
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1694
}
1695

1696
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1697
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1698
        eopts := parseOpts(opts)
4✔
1699
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1700
                return ae
×
1701
        }
×
1702

1703
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1704
}
1705

1706
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1707
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
7✔
1708
        eopts := parseOpts(opts)
7✔
1709
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
1710
                return ae
×
1711
        }
×
1712

1713
        return ApiErrors[JSMessageTTLDisabledErr]
7✔
1714
}
1715

1716
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1717
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
18✔
1718
        eopts := parseOpts(opts)
18✔
1719
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
1720
                return ae
×
1721
        }
×
1722

1723
        return ApiErrors[JSMessageTTLInvalidErr]
18✔
1724
}
1725

1726
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1727
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1728
        eopts := parseOpts(opts)
×
1729
        if ae, ok := eopts.err.(*ApiError); ok {
×
1730
                return ae
×
1731
        }
×
1732

1733
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1734
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1735
        return &ApiError{
×
1736
                Code:        e.Code,
×
1737
                ErrCode:     e.ErrCode,
×
1738
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1739
        }
×
1740
}
1741

1742
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1743
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1744
        eopts := parseOpts(opts)
×
1745
        if ae, ok := eopts.err.(*ApiError); ok {
×
1746
                return ae
×
1747
        }
×
1748

1749
        return ApiErrors[JSMirrorInvalidStreamName]
×
1750
}
1751

1752
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1753
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1754
        eopts := parseOpts(opts)
2✔
1755
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1756
                return ae
×
1757
        }
×
1758

1759
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
1760
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1761
        return &ApiError{
2✔
1762
                Code:        e.Code,
2✔
1763
                ErrCode:     e.ErrCode,
2✔
1764
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1765
        }
2✔
1766
}
1767

1768
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1769
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1770
        eopts := parseOpts(opts)
2✔
1771
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1772
                return ae
×
1773
        }
×
1774

1775
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
1776
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1777
        return &ApiError{
2✔
1778
                Code:        e.Code,
2✔
1779
                ErrCode:     e.ErrCode,
2✔
1780
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1781
        }
2✔
1782
}
1783

1784
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
1785
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1786
        eopts := parseOpts(opts)
×
1787
        if ae, ok := eopts.err.(*ApiError); ok {
×
1788
                return ae
×
1789
        }
×
1790

1791
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1792
}
1793

1794
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
1795
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1796
        eopts := parseOpts(opts)
1✔
1797
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1798
                return ae
×
1799
        }
×
1800

1801
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1802
}
1803

1804
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
1805
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
1806
        eopts := parseOpts(opts)
2✔
1807
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1808
                return ae
×
1809
        }
×
1810

1811
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
1812
}
1813

1814
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
1815
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
1816
        eopts := parseOpts(opts)
4✔
1817
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1818
                return ae
×
1819
        }
×
1820

1821
        return ApiErrors[JSMirrorWithCountersErr]
4✔
1822
}
1823

1824
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
1825
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
1826
        eopts := parseOpts(opts)
2✔
1827
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1828
                return ae
×
1829
        }
×
1830

1831
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
1832
}
1833

1834
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
1835
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
1836
        eopts := parseOpts(opts)
×
1837
        if ae, ok := eopts.err.(*ApiError); ok {
×
1838
                return ae
×
1839
        }
×
1840

1841
        return ApiErrors[JSMirrorWithSourcesErr]
×
1842
}
1843

1844
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
1845
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
1846
        eopts := parseOpts(opts)
×
1847
        if ae, ok := eopts.err.(*ApiError); ok {
×
1848
                return ae
×
1849
        }
×
1850

1851
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
1852
}
1853

1854
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
1855
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
1856
        eopts := parseOpts(opts)
×
1857
        if ae, ok := eopts.err.(*ApiError); ok {
×
1858
                return ae
×
1859
        }
×
1860

1861
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
1862
}
1863

1864
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
1865
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
1866
        eopts := parseOpts(opts)
2✔
1867
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1868
                return ae
×
1869
        }
×
1870

1871
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
1872
}
1873

1874
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
1875
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
1876
        eopts := parseOpts(opts)
1✔
1877
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1878
                return ae
×
1879
        }
×
1880

1881
        return ApiErrors[JSNoAccountErr]
1✔
1882
}
1883

1884
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
1885
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
1886
        eopts := parseOpts(opts)
4✔
1887
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1888
                return ae
×
1889
        }
×
1890

1891
        return ApiErrors[JSNoLimitsErr]
4✔
1892
}
1893

1894
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
1895
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
461✔
1896
        eopts := parseOpts(opts)
461✔
1897
        if ae, ok := eopts.err.(*ApiError); ok {
461✔
1898
                return ae
×
1899
        }
×
1900

1901
        return ApiErrors[JSNoMessageFoundErr]
461✔
1902
}
1903

1904
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
1905
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
1906
        eopts := parseOpts(opts)
3✔
1907
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1908
                return ae
×
1909
        }
×
1910

1911
        return ApiErrors[JSNotEmptyRequestErr]
3✔
1912
}
1913

1914
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
1915
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
1916
        eopts := parseOpts(opts)
10✔
1917
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1918
                return ae
×
1919
        }
×
1920

1921
        return ApiErrors[JSNotEnabledErr]
10✔
1922
}
1923

1924
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
1925
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
364✔
1926
        eopts := parseOpts(opts)
364✔
1927
        if ae, ok := eopts.err.(*ApiError); ok {
364✔
1928
                return ae
×
1929
        }
×
1930

1931
        return ApiErrors[JSNotEnabledForAccountErr]
364✔
1932
}
1933

1934
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
1935
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
8✔
1936
        eopts := parseOpts(opts)
8✔
1937
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1938
                return ae
×
1939
        }
×
1940

1941
        e := ApiErrors[JSPedanticErrF]
8✔
1942
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1943
        return &ApiError{
8✔
1944
                Code:        e.Code,
8✔
1945
                ErrCode:     e.ErrCode,
8✔
1946
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1947
        }
8✔
1948
}
1949

1950
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
1951
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
1952
        eopts := parseOpts(opts)
5✔
1953
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1954
                return ae
1✔
1955
        }
1✔
1956

1957
        return ApiErrors[JSPeerRemapErr]
4✔
1958
}
1959

1960
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
1961
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
1962
        eopts := parseOpts(opts)
×
1963
        if ae, ok := eopts.err.(*ApiError); ok {
×
1964
                return ae
×
1965
        }
×
1966

1967
        e := ApiErrors[JSRaftGeneralErrF]
×
1968
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1969
        return &ApiError{
×
1970
                Code:        e.Code,
×
1971
                ErrCode:     e.ErrCode,
×
1972
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1973
        }
×
1974
}
1975

1976
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
1977
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
1978
        eopts := parseOpts(opts)
16✔
1979
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1980
                return ae
×
1981
        }
×
1982

1983
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
1984
}
1985

1986
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
1987
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
1988
        eopts := parseOpts(opts)
1✔
1989
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1990
                return ae
×
1991
        }
×
1992

1993
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
1994
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
1995
        return &ApiError{
1✔
1996
                Code:        e.Code,
1✔
1997
                ErrCode:     e.ErrCode,
1✔
1998
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1999
        }
1✔
2000
}
2001

2002
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2003
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
2004
        eopts := parseOpts(opts)
×
2005
        if ae, ok := eopts.err.(*ApiError); ok {
×
2006
                return ae
×
2007
        }
×
2008

2009
        e := ApiErrors[JSSequenceNotFoundErrF]
×
2010
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
×
2011
        return &ApiError{
×
2012
                Code:        e.Code,
×
2013
                ErrCode:     e.ErrCode,
×
2014
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2015
        }
×
2016
}
2017

2018
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2019
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2020
        eopts := parseOpts(opts)
1✔
2021
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2022
                return ae
×
2023
        }
×
2024

2025
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2026
}
2027

2028
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2029
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2030
        eopts := parseOpts(opts)
×
2031
        if ae, ok := eopts.err.(*ApiError); ok {
×
2032
                return ae
×
2033
        }
×
2034

2035
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2036
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2037
        return &ApiError{
×
2038
                Code:        e.Code,
×
2039
                ErrCode:     e.ErrCode,
×
2040
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2041
        }
×
2042
}
2043

2044
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2045
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2046
        eopts := parseOpts(opts)
×
2047
        if ae, ok := eopts.err.(*ApiError); ok {
×
2048
                return ae
×
2049
        }
×
2050

2051
        return ApiErrors[JSSourceDuplicateDetected]
×
2052
}
2053

2054
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2055
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2056
        eopts := parseOpts(opts)
1✔
2057
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2058
                return ae
×
2059
        }
×
2060

2061
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2062
}
2063

2064
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2065
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2066
        eopts := parseOpts(opts)
1✔
2067
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2068
                return ae
×
2069
        }
×
2070

2071
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
2072
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2073
        return &ApiError{
1✔
2074
                Code:        e.Code,
1✔
2075
                ErrCode:     e.ErrCode,
1✔
2076
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2077
        }
1✔
2078
}
2079

2080
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2081
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2082
        eopts := parseOpts(opts)
1✔
2083
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2084
                return ae
×
2085
        }
×
2086

2087
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2088
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2089
        return &ApiError{
1✔
2090
                Code:        e.Code,
1✔
2091
                ErrCode:     e.ErrCode,
1✔
2092
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2093
        }
1✔
2094
}
2095

2096
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2097
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2098
        eopts := parseOpts(opts)
×
2099
        if ae, ok := eopts.err.(*ApiError); ok {
×
2100
                return ae
×
2101
        }
×
2102

2103
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2104
}
2105

2106
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2107
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2108
        eopts := parseOpts(opts)
×
2109
        if ae, ok := eopts.err.(*ApiError); ok {
×
2110
                return ae
×
2111
        }
×
2112

2113
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2114
}
2115

2116
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2117
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2118
        eopts := parseOpts(opts)
×
2119
        if ae, ok := eopts.err.(*ApiError); ok {
×
2120
                return ae
×
2121
        }
×
2122

2123
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2124
}
2125

2126
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2127
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
28✔
2128
        eopts := parseOpts(opts)
28✔
2129
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
2130
                return ae
×
2131
        }
×
2132

2133
        return ApiErrors[JSStorageResourcesExceededErr]
28✔
2134
}
2135

2136
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2137
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2138
        eopts := parseOpts(opts)
×
2139
        if ae, ok := eopts.err.(*ApiError); ok {
×
2140
                return ae
×
2141
        }
×
2142

2143
        e := ApiErrors[JSStreamAssignmentErrF]
×
2144
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2145
        return &ApiError{
×
2146
                Code:        e.Code,
×
2147
                ErrCode:     e.ErrCode,
×
2148
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2149
        }
×
2150
}
2151

2152
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2153
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
73✔
2154
        eopts := parseOpts(opts)
73✔
2155
        if ae, ok := eopts.err.(*ApiError); ok {
143✔
2156
                return ae
70✔
2157
        }
70✔
2158

2159
        e := ApiErrors[JSStreamCreateErrF]
3✔
2160
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2161
        return &ApiError{
3✔
2162
                Code:        e.Code,
3✔
2163
                ErrCode:     e.ErrCode,
3✔
2164
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2165
        }
3✔
2166
}
2167

2168
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2169
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2170
        eopts := parseOpts(opts)
×
2171
        if ae, ok := eopts.err.(*ApiError); ok {
×
2172
                return ae
×
2173
        }
×
2174

2175
        e := ApiErrors[JSStreamDeleteErrF]
×
2176
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2177
        return &ApiError{
×
2178
                Code:        e.Code,
×
2179
                ErrCode:     e.ErrCode,
×
2180
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2181
        }
×
2182
}
2183

2184
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2185
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
38✔
2186
        eopts := parseOpts(opts)
38✔
2187
        if ae, ok := eopts.err.(*ApiError); ok {
38✔
2188
                return ae
×
2189
        }
×
2190

2191
        return ApiErrors[JSStreamDuplicateMessageConflict]
38✔
2192
}
2193

2194
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2195
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2196
        eopts := parseOpts(opts)
×
2197
        if ae, ok := eopts.err.(*ApiError); ok {
×
2198
                return ae
×
2199
        }
×
2200

2201
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2202
}
2203

2204
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2205
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2206
        eopts := parseOpts(opts)
2✔
2207
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2208
                return ae
×
2209
        }
×
2210

2211
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2212
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2213
        return &ApiError{
2✔
2214
                Code:        e.Code,
2✔
2215
                ErrCode:     e.ErrCode,
2✔
2216
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2217
        }
2✔
2218
}
2219

2220
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2221
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2222
        eopts := parseOpts(opts)
×
2223
        if ae, ok := eopts.err.(*ApiError); ok {
×
2224
                return ae
×
2225
        }
×
2226

2227
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2228
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2229
        return &ApiError{
×
2230
                Code:        e.Code,
×
2231
                ErrCode:     e.ErrCode,
×
2232
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2233
        }
×
2234
}
2235

2236
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2237
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2238
        eopts := parseOpts(opts)
3✔
2239
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2240
                return ae
×
2241
        }
×
2242

2243
        e := ApiErrors[JSStreamGeneralErrorF]
3✔
2244
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2245
        return &ApiError{
3✔
2246
                Code:        e.Code,
3✔
2247
                ErrCode:     e.ErrCode,
3✔
2248
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2249
        }
3✔
2250
}
2251

2252
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2253
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2254
        eopts := parseOpts(opts)
1✔
2255
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2256
                return ae
×
2257
        }
×
2258

2259
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2260
}
2261

2262
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2263
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2264
        eopts := parseOpts(opts)
×
2265
        if ae, ok := eopts.err.(*ApiError); ok {
×
2266
                return ae
×
2267
        }
×
2268

2269
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2270
}
2271

2272
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2273
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
139✔
2274
        eopts := parseOpts(opts)
139✔
2275
        if ae, ok := eopts.err.(*ApiError); ok {
162✔
2276
                return ae
23✔
2277
        }
23✔
2278

2279
        e := ApiErrors[JSStreamInvalidConfigF]
116✔
2280
        args := e.toReplacerArgs([]interface{}{"{err}", err})
116✔
2281
        return &ApiError{
116✔
2282
                Code:        e.Code,
116✔
2283
                ErrCode:     e.ErrCode,
116✔
2284
                Description: strings.NewReplacer(args...).Replace(e.Description),
116✔
2285
        }
116✔
2286
}
2287

2288
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2289
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2290
        eopts := parseOpts(opts)
×
2291
        if ae, ok := eopts.err.(*ApiError); ok {
×
2292
                return ae
×
2293
        }
×
2294

2295
        return ApiErrors[JSStreamInvalidErr]
×
2296
}
2297

2298
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2299
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2300
        eopts := parseOpts(opts)
×
2301
        if ae, ok := eopts.err.(*ApiError); ok {
×
2302
                return ae
×
2303
        }
×
2304

2305
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2306
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2307
        return &ApiError{
×
2308
                Code:        e.Code,
×
2309
                ErrCode:     e.ErrCode,
×
2310
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2311
        }
×
2312
}
2313

2314
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2315
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2316
        eopts := parseOpts(opts)
8✔
2317
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2318
                return ae
8✔
2319
        }
8✔
2320

2321
        e := ApiErrors[JSStreamLimitsErrF]
×
2322
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2323
        return &ApiError{
×
2324
                Code:        e.Code,
×
2325
                ErrCode:     e.ErrCode,
×
2326
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2327
        }
×
2328
}
2329

2330
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2331
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2332
        eopts := parseOpts(opts)
3✔
2333
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2334
                return ae
×
2335
        }
×
2336

2337
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2338
}
2339

2340
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2341
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2342
        eopts := parseOpts(opts)
2✔
2343
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2344
                return ae
×
2345
        }
×
2346

2347
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2348
}
2349

2350
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2351
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
15✔
2352
        eopts := parseOpts(opts)
15✔
2353
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2354
                return ae
×
2355
        }
×
2356

2357
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
15✔
2358
}
2359

2360
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2361
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
4✔
2362
        eopts := parseOpts(opts)
4✔
2363
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2364
                return ae
×
2365
        }
×
2366

2367
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
2368
}
2369

2370
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2371
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2372
        eopts := parseOpts(opts)
3✔
2373
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2374
                return ae
×
2375
        }
×
2376

2377
        return ApiErrors[JSStreamMismatchErr]
3✔
2378
}
2379

2380
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2381
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2382
        eopts := parseOpts(opts)
4✔
2383
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2384
                return ae
×
2385
        }
×
2386

2387
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2388
}
2389

2390
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2391
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2392
        eopts := parseOpts(opts)
2✔
2393
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2394
                return ae
×
2395
        }
×
2396

2397
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2398
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2399
        return &ApiError{
2✔
2400
                Code:        e.Code,
2✔
2401
                ErrCode:     e.ErrCode,
2✔
2402
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2403
        }
2✔
2404
}
2405

2406
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2407
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2408
        eopts := parseOpts(opts)
×
2409
        if ae, ok := eopts.err.(*ApiError); ok {
×
2410
                return ae
×
2411
        }
×
2412

2413
        return ApiErrors[JSStreamMoveNotInProgress]
×
2414
}
2415

2416
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2417
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2418
        eopts := parseOpts(opts)
1✔
2419
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2420
                return ae
×
2421
        }
×
2422

2423
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1✔
2424
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2425
        return &ApiError{
1✔
2426
                Code:        e.Code,
1✔
2427
                ErrCode:     e.ErrCode,
1✔
2428
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2429
        }
1✔
2430
}
2431

2432
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2433
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2434
        eopts := parseOpts(opts)
6✔
2435
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2436
                return ae
×
2437
        }
×
2438

2439
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2440
}
2441

2442
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2443
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
×
2444
        eopts := parseOpts(opts)
×
2445
        if ae, ok := eopts.err.(*ApiError); ok {
×
2446
                return ae
×
2447
        }
×
2448

2449
        return ApiErrors[JSStreamNameExistErr]
×
2450
}
2451

2452
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2453
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2454
        eopts := parseOpts(opts)
3✔
2455
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2456
                return ae
×
2457
        }
×
2458

2459
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2460
}
2461

2462
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2463
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
24,949✔
2464
        eopts := parseOpts(opts)
24,949✔
2465
        if ae, ok := eopts.err.(*ApiError); ok {
25,615✔
2466
                return ae
666✔
2467
        }
666✔
2468

2469
        return ApiErrors[JSStreamNotFoundErr]
24,283✔
2470
}
2471

2472
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2473
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2474
        eopts := parseOpts(opts)
5✔
2475
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2476
                return ae
×
2477
        }
×
2478

2479
        return ApiErrors[JSStreamNotMatchErr]
5✔
2480
}
2481

2482
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2483
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2484
        eopts := parseOpts(opts)
6✔
2485
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2486
                return ae
×
2487
        }
×
2488

2489
        return ApiErrors[JSStreamOfflineErr]
6✔
2490
}
2491

2492
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2493
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2494
        eopts := parseOpts(opts)
1✔
2495
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2496
                return ae
×
2497
        }
×
2498

2499
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2500
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2501
        return &ApiError{
1✔
2502
                Code:        e.Code,
1✔
2503
                ErrCode:     e.ErrCode,
1✔
2504
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2505
        }
1✔
2506
}
2507

2508
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2509
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2510
        eopts := parseOpts(opts)
1✔
2511
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2512
                return ae
×
2513
        }
×
2514

2515
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2516
}
2517

2518
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2519
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2520
        eopts := parseOpts(opts)
×
2521
        if ae, ok := eopts.err.(*ApiError); ok {
×
2522
                return ae
×
2523
        }
×
2524

2525
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2526
}
2527

2528
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2529
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2530
        eopts := parseOpts(opts)
7✔
2531
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2532
                return ae
2✔
2533
        }
2✔
2534

2535
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2536
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2537
        return &ApiError{
5✔
2538
                Code:        e.Code,
5✔
2539
                ErrCode:     e.ErrCode,
5✔
2540
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2541
        }
5✔
2542
}
2543

2544
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2545
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
2546
        eopts := parseOpts(opts)
8✔
2547
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2548
                return ae
×
2549
        }
×
2550

2551
        e := ApiErrors[JSStreamRollupFailedF]
8✔
2552
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
2553
        return &ApiError{
8✔
2554
                Code:        e.Code,
8✔
2555
                ErrCode:     e.ErrCode,
8✔
2556
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
2557
        }
8✔
2558
}
2559

2560
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2561
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2562
        eopts := parseOpts(opts)
10✔
2563
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2564
                return ae
×
2565
        }
×
2566

2567
        return ApiErrors[JSStreamSealedErr]
10✔
2568
}
2569

2570
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2571
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2572
        eopts := parseOpts(opts)
×
2573
        if ae, ok := eopts.err.(*ApiError); ok {
×
2574
                return ae
×
2575
        }
×
2576

2577
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2578
}
2579

2580
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2581
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2582
        eopts := parseOpts(opts)
×
2583
        if ae, ok := eopts.err.(*ApiError); ok {
×
2584
                return ae
×
2585
        }
×
2586

2587
        e := ApiErrors[JSStreamSnapshotErrF]
×
2588
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2589
        return &ApiError{
×
2590
                Code:        e.Code,
×
2591
                ErrCode:     e.ErrCode,
×
2592
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2593
        }
×
2594
}
2595

2596
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2597
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
1,029✔
2598
        eopts := parseOpts(opts)
1,029✔
2599
        if ae, ok := eopts.err.(*ApiError); ok {
1,029✔
2600
                return ae
×
2601
        }
×
2602

2603
        e := ApiErrors[JSStreamStoreFailedF]
1,029✔
2604
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,029✔
2605
        return &ApiError{
1,029✔
2606
                Code:        e.Code,
1,029✔
2607
                ErrCode:     e.ErrCode,
1,029✔
2608
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,029✔
2609
        }
1,029✔
2610
}
2611

2612
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2613
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
31✔
2614
        eopts := parseOpts(opts)
31✔
2615
        if ae, ok := eopts.err.(*ApiError); ok {
31✔
2616
                return ae
×
2617
        }
×
2618

2619
        return ApiErrors[JSStreamSubjectOverlapErr]
31✔
2620
}
2621

2622
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2623
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2624
        eopts := parseOpts(opts)
×
2625
        if ae, ok := eopts.err.(*ApiError); ok {
×
2626
                return ae
×
2627
        }
×
2628

2629
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
2630
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2631
        return &ApiError{
×
2632
                Code:        e.Code,
×
2633
                ErrCode:     e.ErrCode,
×
2634
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2635
        }
×
2636
}
2637

2638
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2639
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2640
        eopts := parseOpts(opts)
1✔
2641
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2642
                return ae
1✔
2643
        }
1✔
2644

2645
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2646
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2647
        return &ApiError{
×
2648
                Code:        e.Code,
×
2649
                ErrCode:     e.ErrCode,
×
2650
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2651
        }
×
2652
}
2653

2654
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2655
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2656
        eopts := parseOpts(opts)
4✔
2657
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2658
                return ae
×
2659
        }
×
2660

2661
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2662
}
2663

2664
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2665
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
180✔
2666
        eopts := parseOpts(opts)
180✔
2667
        if ae, ok := eopts.err.(*ApiError); ok {
180✔
2668
                return ae
×
2669
        }
×
2670

2671
        return ApiErrors[JSStreamTooManyRequests]
180✔
2672
}
2673

2674
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
2675
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2676
        eopts := parseOpts(opts)
1✔
2677
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2678
                return ae
×
2679
        }
×
2680

2681
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
2682
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2683
        return &ApiError{
1✔
2684
                Code:        e.Code,
1✔
2685
                ErrCode:     e.ErrCode,
1✔
2686
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2687
        }
1✔
2688
}
2689

2690
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2691
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2692
        eopts := parseOpts(opts)
1✔
2693
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2694
                return ae
×
2695
        }
×
2696

2697
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
2698
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2699
        return &ApiError{
1✔
2700
                Code:        e.Code,
1✔
2701
                ErrCode:     e.ErrCode,
1✔
2702
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2703
        }
1✔
2704
}
2705

2706
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2707
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
23✔
2708
        eopts := parseOpts(opts)
23✔
2709
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2710
                return ae
17✔
2711
        }
17✔
2712

2713
        e := ApiErrors[JSStreamUpdateErrF]
6✔
2714
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
2715
        return &ApiError{
6✔
2716
                Code:        e.Code,
6✔
2717
                ErrCode:     e.ErrCode,
6✔
2718
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
2719
        }
6✔
2720
}
2721

2722
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2723
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2724
        eopts := parseOpts(opts)
5✔
2725
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2726
                return ae
×
2727
        }
×
2728

2729
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
2730
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
2731
        return &ApiError{
5✔
2732
                Code:        e.Code,
5✔
2733
                ErrCode:     e.ErrCode,
5✔
2734
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2735
        }
5✔
2736
}
2737

2738
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
2739
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
11✔
2740
        eopts := parseOpts(opts)
11✔
2741
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2742
                return ae
×
2743
        }
×
2744

2745
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
11✔
2746
}
2747

2748
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
2749
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
57✔
2750
        eopts := parseOpts(opts)
57✔
2751
        if ae, ok := eopts.err.(*ApiError); ok {
57✔
2752
                return ae
×
2753
        }
×
2754

2755
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
57✔
2756
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
57✔
2757
        return &ApiError{
57✔
2758
                Code:        e.Code,
57✔
2759
                ErrCode:     e.ErrCode,
57✔
2760
                Description: strings.NewReplacer(args...).Replace(e.Description),
57✔
2761
        }
57✔
2762
}
2763

2764
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
2765
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
2766
        eopts := parseOpts(opts)
×
2767
        if ae, ok := eopts.err.(*ApiError); ok {
×
2768
                return ae
×
2769
        }
×
2770

2771
        return ApiErrors[JSTempStorageFailedErr]
×
2772
}
2773

2774
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
2775
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
2776
        eopts := parseOpts(opts)
1✔
2777
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2778
                return ae
×
2779
        }
×
2780

2781
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
1✔
2782
}
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