github.com/nats-io/nats-server/v2@v2.11.0-preview.2/server/jetstream_errors_generated.go (about)

     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  	// JSBadRequestErr bad request
    12  	JSBadRequestErr ErrorIdentifier = 10003
    13  
    14  	// JSClusterIncompleteErr incomplete results
    15  	JSClusterIncompleteErr ErrorIdentifier = 10004
    16  
    17  	// JSClusterNoPeersErrF Error causing no peers to be available ({err})
    18  	JSClusterNoPeersErrF ErrorIdentifier = 10005
    19  
    20  	// JSClusterNotActiveErr JetStream not in clustered mode
    21  	JSClusterNotActiveErr ErrorIdentifier = 10006
    22  
    23  	// JSClusterNotAssignedErr JetStream cluster not assigned to this server
    24  	JSClusterNotAssignedErr ErrorIdentifier = 10007
    25  
    26  	// JSClusterNotAvailErr JetStream system temporarily unavailable
    27  	JSClusterNotAvailErr ErrorIdentifier = 10008
    28  
    29  	// JSClusterNotLeaderErr JetStream cluster can not handle request
    30  	JSClusterNotLeaderErr ErrorIdentifier = 10009
    31  
    32  	// JSClusterPeerNotMemberErr peer not a member
    33  	JSClusterPeerNotMemberErr ErrorIdentifier = 10040
    34  
    35  	// JSClusterRequiredErr JetStream clustering support required
    36  	JSClusterRequiredErr ErrorIdentifier = 10010
    37  
    38  	// JSClusterServerNotMemberErr server is not a member of the cluster
    39  	JSClusterServerNotMemberErr ErrorIdentifier = 10044
    40  
    41  	// JSClusterTagsErr tags placement not supported for operation
    42  	JSClusterTagsErr ErrorIdentifier = 10011
    43  
    44  	// JSClusterUnSupportFeatureErr not currently supported in clustered mode
    45  	JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
    46  
    47  	// JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
    48  	JSConsumerAlreadyExists ErrorIdentifier = 10148
    49  
    50  	// JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
    51  	JSConsumerBadDurableNameErr ErrorIdentifier = 10103
    52  
    53  	// JSConsumerConfigRequiredErr consumer config required
    54  	JSConsumerConfigRequiredErr ErrorIdentifier = 10078
    55  
    56  	// JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
    57  	JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
    58  
    59  	// JSConsumerCreateErrF General consumer creation failure string ({err})
    60  	JSConsumerCreateErrF ErrorIdentifier = 10012
    61  
    62  	// JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
    63  	JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
    64  
    65  	// JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
    66  	JSConsumerDeliverCycleErr ErrorIdentifier = 10081
    67  
    68  	// JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
    69  	JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
    70  
    71  	// JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
    72  	JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
    73  
    74  	// JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
    75  	JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
    76  
    77  	// JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
    78  	JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
    79  
    80  	// JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
    81  	JSConsumerDoesNotExist ErrorIdentifier = 10149
    82  
    83  	// JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
    84  	JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
    85  
    86  	// JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
    87  	JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
    88  
    89  	// JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
    90  	JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
    91  
    92  	// JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
    93  	JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
    94  
    95  	// JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
    96  	JSConsumerEmptyFilter ErrorIdentifier = 10139
    97  
    98  	// JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
    99  	JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
   100  
   101  	// JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
   102  	JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
   103  
   104  	// JSConsumerExistingActiveErr consumer already exists and is still active
   105  	JSConsumerExistingActiveErr ErrorIdentifier = 10105
   106  
   107  	// JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
   108  	JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
   109  
   110  	// JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
   111  	JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
   112  
   113  	// JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
   114  	JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
   115  
   116  	// JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
   117  	JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
   118  
   119  	// JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
   120  	JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
   121  
   122  	// JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
   123  	JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
   124  
   125  	// JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
   126  	JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
   127  
   128  	// JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
   129  	JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
   130  
   131  	// JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
   132  	JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
   133  
   134  	// JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
   135  	JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
   136  
   137  	// JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
   138  	JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
   139  
   140  	// JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
   141  	JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
   142  
   143  	// JSConsumerMaxRequestExpiresToSmall consumer max request expires needs to be >= 1ms
   144  	JSConsumerMaxRequestExpiresToSmall ErrorIdentifier = 10115
   145  
   146  	// JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
   147  	JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
   148  
   149  	// JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
   150  	JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
   151  
   152  	// JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
   153  	JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
   154  
   155  	// JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
   156  	JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
   157  
   158  	// JSConsumerNameExistErr consumer name already in use
   159  	JSConsumerNameExistErr ErrorIdentifier = 10013
   160  
   161  	// JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
   162  	JSConsumerNameTooLongErrF ErrorIdentifier = 10102
   163  
   164  	// JSConsumerNotFoundErr consumer not found
   165  	JSConsumerNotFoundErr ErrorIdentifier = 10014
   166  
   167  	// JSConsumerOfflineErr consumer is offline
   168  	JSConsumerOfflineErr ErrorIdentifier = 10119
   169  
   170  	// JSConsumerOnMappedErr consumer direct on a mapped consumer
   171  	JSConsumerOnMappedErr ErrorIdentifier = 10092
   172  
   173  	// JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
   174  	JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
   175  
   176  	// JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
   177  	JSConsumerPullNotDurableErr ErrorIdentifier = 10085
   178  
   179  	// JSConsumerPullRequiresAckErr consumer in pull mode requires ack policy
   180  	JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
   181  
   182  	// JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
   183  	JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
   184  
   185  	// JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
   186  	JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
   187  
   188  	// JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
   189  	JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
   190  
   191  	// JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
   192  	JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
   193  
   194  	// JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
   195  	JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
   196  
   197  	// JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
   198  	JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
   199  
   200  	// JSConsumerStoreFailedErrF error creating store for consumer: {err}
   201  	JSConsumerStoreFailedErrF ErrorIdentifier = 10104
   202  
   203  	// JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
   204  	JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
   205  
   206  	// JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
   207  	JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
   208  
   209  	// JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
   210  	JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
   211  
   212  	// JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
   213  	JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
   214  
   215  	// JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
   216  	JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
   217  
   218  	// JSInsufficientResourcesErr insufficient resources
   219  	JSInsufficientResourcesErr ErrorIdentifier = 10023
   220  
   221  	// JSInvalidJSONErr invalid JSON
   222  	JSInvalidJSONErr ErrorIdentifier = 10025
   223  
   224  	// JSMaximumConsumersLimitErr maximum consumers limit reached
   225  	JSMaximumConsumersLimitErr ErrorIdentifier = 10026
   226  
   227  	// JSMaximumStreamsLimitErr maximum number of streams reached
   228  	JSMaximumStreamsLimitErr ErrorIdentifier = 10027
   229  
   230  	// JSMemoryResourcesExceededErr insufficient memory resources available
   231  	JSMemoryResourcesExceededErr ErrorIdentifier = 10028
   232  
   233  	// JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
   234  	JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
   235  
   236  	// JSMirrorInvalidStreamName mirrored stream name is invalid
   237  	JSMirrorInvalidStreamName ErrorIdentifier = 10142
   238  
   239  	// JSMirrorInvalidSubjectFilter mirror subject filter is invalid
   240  	JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
   241  
   242  	// JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
   243  	JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
   244  
   245  	// JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
   246  	JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
   247  
   248  	// JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
   249  	JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
   250  
   251  	// JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
   252  	JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
   253  
   254  	// JSMirrorWithSourcesErr stream mirrors can not also contain other sources
   255  	JSMirrorWithSourcesErr ErrorIdentifier = 10031
   256  
   257  	// JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
   258  	JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
   259  
   260  	// JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
   261  	JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
   262  
   263  	// JSMirrorWithSubjectsErr stream mirrors can not contain subjects
   264  	JSMirrorWithSubjectsErr ErrorIdentifier = 10034
   265  
   266  	// JSNoAccountErr account not found
   267  	JSNoAccountErr ErrorIdentifier = 10035
   268  
   269  	// JSNoLimitsErr no JetStream default or applicable tiered limit present
   270  	JSNoLimitsErr ErrorIdentifier = 10120
   271  
   272  	// JSNoMessageFoundErr no message found
   273  	JSNoMessageFoundErr ErrorIdentifier = 10037
   274  
   275  	// JSNotEmptyRequestErr expected an empty request payload
   276  	JSNotEmptyRequestErr ErrorIdentifier = 10038
   277  
   278  	// JSNotEnabledErr JetStream not enabled
   279  	JSNotEnabledErr ErrorIdentifier = 10076
   280  
   281  	// JSNotEnabledForAccountErr JetStream not enabled for account
   282  	JSNotEnabledForAccountErr ErrorIdentifier = 10039
   283  
   284  	// JSPeerRemapErr peer remap failed
   285  	JSPeerRemapErr ErrorIdentifier = 10075
   286  
   287  	// JSRaftGeneralErrF General RAFT error string ({err})
   288  	JSRaftGeneralErrF ErrorIdentifier = 10041
   289  
   290  	// JSReplicasCountCannotBeNegative replicas count cannot be negative
   291  	JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
   292  
   293  	// JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
   294  	JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
   295  
   296  	// JSSequenceNotFoundErrF sequence {seq} not found
   297  	JSSequenceNotFoundErrF ErrorIdentifier = 10043
   298  
   299  	// JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
   300  	JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
   301  
   302  	// JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
   303  	JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
   304  
   305  	// JSSourceDuplicateDetected source stream, filter and transform (plus external if present) must form a unique combination (duplicate source configuration detected)
   306  	JSSourceDuplicateDetected ErrorIdentifier = 10140
   307  
   308  	// JSSourceInvalidStreamName sourced stream name is invalid
   309  	JSSourceInvalidStreamName ErrorIdentifier = 10141
   310  
   311  	// JSSourceInvalidSubjectFilter source subject filter is invalid
   312  	JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
   313  
   314  	// JSSourceInvalidTransformDestination source transform destination is invalid
   315  	JSSourceInvalidTransformDestination ErrorIdentifier = 10146
   316  
   317  	// JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
   318  	JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
   319  
   320  	// JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
   321  	JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
   322  
   323  	// JSSourceOverlappingSubjectFilters source filters can not overlap
   324  	JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
   325  
   326  	// JSStorageResourcesExceededErr insufficient storage resources available
   327  	JSStorageResourcesExceededErr ErrorIdentifier = 10047
   328  
   329  	// JSStreamAssignmentErrF Generic stream assignment error string ({err})
   330  	JSStreamAssignmentErrF ErrorIdentifier = 10048
   331  
   332  	// JSStreamCreateErrF Generic stream creation error string ({err})
   333  	JSStreamCreateErrF ErrorIdentifier = 10049
   334  
   335  	// JSStreamDeleteErrF General stream deletion error string ({err})
   336  	JSStreamDeleteErrF ErrorIdentifier = 10050
   337  
   338  	// JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
   339  	JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
   340  
   341  	// JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
   342  	JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
   343  
   344  	// JSStreamGeneralErrorF General stream failure string ({err})
   345  	JSStreamGeneralErrorF ErrorIdentifier = 10051
   346  
   347  	// JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
   348  	JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
   349  
   350  	// JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
   351  	JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
   352  
   353  	// JSStreamInvalidConfigF Stream configuration validation error string ({err})
   354  	JSStreamInvalidConfigF ErrorIdentifier = 10052
   355  
   356  	// JSStreamInvalidErr stream not valid
   357  	JSStreamInvalidErr ErrorIdentifier = 10096
   358  
   359  	// JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
   360  	JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
   361  
   362  	// JSStreamLimitsErrF General stream limits exceeded error string ({err})
   363  	JSStreamLimitsErrF ErrorIdentifier = 10053
   364  
   365  	// JSStreamMaxBytesRequired account requires a stream config to have max bytes set
   366  	JSStreamMaxBytesRequired ErrorIdentifier = 10113
   367  
   368  	// JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
   369  	JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
   370  
   371  	// JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
   372  	JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
   373  
   374  	// JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
   375  	JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
   376  
   377  	// JSStreamMismatchErr stream name in subject does not match request
   378  	JSStreamMismatchErr ErrorIdentifier = 10056
   379  
   380  	// JSStreamMoveAndScaleErr can not move and scale a stream in a single update
   381  	JSStreamMoveAndScaleErr ErrorIdentifier = 10123
   382  
   383  	// JSStreamMoveInProgressF stream move already in progress: {msg}
   384  	JSStreamMoveInProgressF ErrorIdentifier = 10124
   385  
   386  	// JSStreamMoveNotInProgress stream move not in progress
   387  	JSStreamMoveNotInProgress ErrorIdentifier = 10129
   388  
   389  	// JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
   390  	JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
   391  
   392  	// JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
   393  	JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
   394  
   395  	// JSStreamNameExistErr stream name already in use with a different configuration
   396  	JSStreamNameExistErr ErrorIdentifier = 10058
   397  
   398  	// JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
   399  	JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
   400  
   401  	// JSStreamNotFoundErr stream not found
   402  	JSStreamNotFoundErr ErrorIdentifier = 10059
   403  
   404  	// JSStreamNotMatchErr expected stream does not match
   405  	JSStreamNotMatchErr ErrorIdentifier = 10060
   406  
   407  	// JSStreamOfflineErr stream is offline
   408  	JSStreamOfflineErr ErrorIdentifier = 10118
   409  
   410  	// JSStreamPurgeFailedF Generic stream purge failure error string ({err})
   411  	JSStreamPurgeFailedF ErrorIdentifier = 10110
   412  
   413  	// JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
   414  	JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
   415  
   416  	// JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
   417  	JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
   418  
   419  	// JSStreamRestoreErrF restore failed: {err}
   420  	JSStreamRestoreErrF ErrorIdentifier = 10062
   421  
   422  	// JSStreamRollupFailedF Generic stream rollup failure error string ({err})
   423  	JSStreamRollupFailedF ErrorIdentifier = 10111
   424  
   425  	// JSStreamSealedErr invalid operation on sealed stream
   426  	JSStreamSealedErr ErrorIdentifier = 10109
   427  
   428  	// JSStreamSequenceNotMatchErr expected stream sequence does not match
   429  	JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
   430  
   431  	// JSStreamSnapshotErrF snapshot failed: {err}
   432  	JSStreamSnapshotErrF ErrorIdentifier = 10064
   433  
   434  	// JSStreamStoreFailedF Generic error when storing a message failed ({err})
   435  	JSStreamStoreFailedF ErrorIdentifier = 10077
   436  
   437  	// JSStreamSubjectOverlapErr subjects overlap with an existing stream
   438  	JSStreamSubjectOverlapErr ErrorIdentifier = 10065
   439  
   440  	// JSStreamTemplateCreateErrF Generic template creation failed string ({err})
   441  	JSStreamTemplateCreateErrF ErrorIdentifier = 10066
   442  
   443  	// JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
   444  	JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
   445  
   446  	// JSStreamTemplateNotFoundErr template not found
   447  	JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
   448  
   449  	// JSStreamUpdateErrF Generic stream update error string ({err})
   450  	JSStreamUpdateErrF ErrorIdentifier = 10069
   451  
   452  	// JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
   453  	JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
   454  
   455  	// JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
   456  	JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
   457  
   458  	// JSTempStorageFailedErr JetStream unable to open temp storage for restore
   459  	JSTempStorageFailedErr ErrorIdentifier = 10072
   460  
   461  	// JSTemplateNameNotMatchSubjectErr template name in subject does not match request
   462  	JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
   463  )
   464  
   465  var (
   466  	ApiErrors = map[ErrorIdentifier]*ApiError{
   467  		JSAccountResourcesExceededErr:              {Code: 400, ErrCode: 10002, Description: "resource limits exceeded for account"},
   468  		JSBadRequestErr:                            {Code: 400, ErrCode: 10003, Description: "bad request"},
   469  		JSClusterIncompleteErr:                     {Code: 503, ErrCode: 10004, Description: "incomplete results"},
   470  		JSClusterNoPeersErrF:                       {Code: 400, ErrCode: 10005, Description: "{err}"},
   471  		JSClusterNotActiveErr:                      {Code: 500, ErrCode: 10006, Description: "JetStream not in clustered mode"},
   472  		JSClusterNotAssignedErr:                    {Code: 500, ErrCode: 10007, Description: "JetStream cluster not assigned to this server"},
   473  		JSClusterNotAvailErr:                       {Code: 503, ErrCode: 10008, Description: "JetStream system temporarily unavailable"},
   474  		JSClusterNotLeaderErr:                      {Code: 500, ErrCode: 10009, Description: "JetStream cluster can not handle request"},
   475  		JSClusterPeerNotMemberErr:                  {Code: 400, ErrCode: 10040, Description: "peer not a member"},
   476  		JSClusterRequiredErr:                       {Code: 503, ErrCode: 10010, Description: "JetStream clustering support required"},
   477  		JSClusterServerNotMemberErr:                {Code: 400, ErrCode: 10044, Description: "server is not a member of the cluster"},
   478  		JSClusterTagsErr:                           {Code: 400, ErrCode: 10011, Description: "tags placement not supported for operation"},
   479  		JSClusterUnSupportFeatureErr:               {Code: 503, ErrCode: 10036, Description: "not currently supported in clustered mode"},
   480  		JSConsumerAlreadyExists:                    {Code: 400, ErrCode: 10148, Description: "consumer already exists"},
   481  		JSConsumerBadDurableNameErr:                {Code: 400, ErrCode: 10103, Description: "durable name can not contain '.', '*', '>'"},
   482  		JSConsumerConfigRequiredErr:                {Code: 400, ErrCode: 10078, Description: "consumer config required"},
   483  		JSConsumerCreateDurableAndNameMismatch:     {Code: 400, ErrCode: 10132, Description: "Consumer Durable and Name have to be equal if both are provided"},
   484  		JSConsumerCreateErrF:                       {Code: 500, ErrCode: 10012, Description: "{err}"},
   485  		JSConsumerCreateFilterSubjectMismatchErr:   {Code: 400, ErrCode: 10131, Description: "Consumer create request did not match filtered subject from create subject"},
   486  		JSConsumerDeliverCycleErr:                  {Code: 400, ErrCode: 10081, Description: "consumer deliver subject forms a cycle"},
   487  		JSConsumerDeliverToWildcardsErr:            {Code: 400, ErrCode: 10079, Description: "consumer deliver subject has wildcards"},
   488  		JSConsumerDescriptionTooLongErrF:           {Code: 400, ErrCode: 10107, Description: "consumer description is too long, maximum allowed is {max}"},
   489  		JSConsumerDirectRequiresEphemeralErr:       {Code: 400, ErrCode: 10091, Description: "consumer direct requires an ephemeral consumer"},
   490  		JSConsumerDirectRequiresPushErr:            {Code: 400, ErrCode: 10090, Description: "consumer direct requires a push based consumer"},
   491  		JSConsumerDoesNotExist:                     {Code: 400, ErrCode: 10149, Description: "consumer does not exist"},
   492  		JSConsumerDuplicateFilterSubjects:          {Code: 400, ErrCode: 10136, Description: "consumer cannot have both FilterSubject and FilterSubjects specified"},
   493  		JSConsumerDurableNameNotInSubjectErr:       {Code: 400, ErrCode: 10016, Description: "consumer expected to be durable but no durable name set in subject"},
   494  		JSConsumerDurableNameNotMatchSubjectErr:    {Code: 400, ErrCode: 10017, Description: "consumer name in subject does not match durable name in request"},
   495  		JSConsumerDurableNameNotSetErr:             {Code: 400, ErrCode: 10018, Description: "consumer expected to be durable but a durable name was not set"},
   496  		JSConsumerEmptyFilter:                      {Code: 400, ErrCode: 10139, Description: "consumer filter in FilterSubjects cannot be empty"},
   497  		JSConsumerEphemeralWithDurableInSubjectErr: {Code: 400, ErrCode: 10019, Description: "consumer expected to be ephemeral but detected a durable name set in subject"},
   498  		JSConsumerEphemeralWithDurableNameErr:      {Code: 400, ErrCode: 10020, Description: "consumer expected to be ephemeral but a durable name was set in request"},
   499  		JSConsumerExistingActiveErr:                {Code: 400, ErrCode: 10105, Description: "consumer already exists and is still active"},
   500  		JSConsumerFCRequiresPushErr:                {Code: 400, ErrCode: 10089, Description: "consumer flow control requires a push based consumer"},
   501  		JSConsumerFilterNotSubsetErr:               {Code: 400, ErrCode: 10093, Description: "consumer filter subject is not a valid subset of the interest subjects"},
   502  		JSConsumerHBRequiresPushErr:                {Code: 400, ErrCode: 10088, Description: "consumer idle heartbeat requires a push based consumer"},
   503  		JSConsumerInactiveThresholdExcess:          {Code: 400, ErrCode: 10153, Description: "consumer inactive threshold exceeds system limit of {limit}"},
   504  		JSConsumerInvalidDeliverSubject:            {Code: 400, ErrCode: 10112, Description: "invalid push consumer deliver subject"},
   505  		JSConsumerInvalidPolicyErrF:                {Code: 400, ErrCode: 10094, Description: "{err}"},
   506  		JSConsumerInvalidSamplingErrF:              {Code: 400, ErrCode: 10095, Description: "failed to parse consumer sampling configuration: {err}"},
   507  		JSConsumerMaxDeliverBackoffErr:             {Code: 400, ErrCode: 10116, Description: "max deliver is required to be > length of backoff values"},
   508  		JSConsumerMaxPendingAckExcessErrF:          {Code: 400, ErrCode: 10121, Description: "consumer max ack pending exceeds system limit of {limit}"},
   509  		JSConsumerMaxPendingAckPolicyRequiredErr:   {Code: 400, ErrCode: 10082, Description: "consumer requires ack policy for max ack pending"},
   510  		JSConsumerMaxRequestBatchExceededF:         {Code: 400, ErrCode: 10125, Description: "consumer max request batch exceeds server limit of {limit}"},
   511  		JSConsumerMaxRequestBatchNegativeErr:       {Code: 400, ErrCode: 10114, Description: "consumer max request batch needs to be > 0"},
   512  		JSConsumerMaxRequestExpiresToSmall:         {Code: 400, ErrCode: 10115, Description: "consumer max request expires needs to be >= 1ms"},
   513  		JSConsumerMaxWaitingNegativeErr:            {Code: 400, ErrCode: 10087, Description: "consumer max waiting needs to be positive"},
   514  		JSConsumerMetadataLengthErrF:               {Code: 400, ErrCode: 10135, Description: "consumer metadata exceeds maximum size of {limit}"},
   515  		JSConsumerMultipleFiltersNotAllowed:        {Code: 400, ErrCode: 10137, Description: "consumer with multiple subject filters cannot use subject based API"},
   516  		JSConsumerNameContainsPathSeparatorsErr:    {Code: 400, ErrCode: 10127, Description: "Consumer name can not contain path separators"},
   517  		JSConsumerNameExistErr:                     {Code: 400, ErrCode: 10013, Description: "consumer name already in use"},
   518  		JSConsumerNameTooLongErrF:                  {Code: 400, ErrCode: 10102, Description: "consumer name is too long, maximum allowed is {max}"},
   519  		JSConsumerNotFoundErr:                      {Code: 404, ErrCode: 10014, Description: "consumer not found"},
   520  		JSConsumerOfflineErr:                       {Code: 500, ErrCode: 10119, Description: "consumer is offline"},
   521  		JSConsumerOnMappedErr:                      {Code: 400, ErrCode: 10092, Description: "consumer direct on a mapped consumer"},
   522  		JSConsumerOverlappingSubjectFilters:        {Code: 400, ErrCode: 10138, Description: "consumer subject filters cannot overlap"},
   523  		JSConsumerPullNotDurableErr:                {Code: 400, ErrCode: 10085, Description: "consumer in pull mode requires a durable name"},
   524  		JSConsumerPullRequiresAckErr:               {Code: 400, ErrCode: 10084, Description: "consumer in pull mode requires ack policy"},
   525  		JSConsumerPullWithRateLimitErr:             {Code: 400, ErrCode: 10086, Description: "consumer in pull mode can not have rate limit set"},
   526  		JSConsumerPushMaxWaitingErr:                {Code: 400, ErrCode: 10080, Description: "consumer in push mode can not set max waiting"},
   527  		JSConsumerReplacementWithDifferentNameErr:  {Code: 400, ErrCode: 10106, Description: "consumer replacement durable config not the same"},
   528  		JSConsumerReplicasExceedsStream:            {Code: 400, ErrCode: 10126, Description: "consumer config replica count exceeds parent stream"},
   529  		JSConsumerReplicasShouldMatchStream:        {Code: 400, ErrCode: 10134, Description: "consumer config replicas must match interest retention stream's replicas"},
   530  		JSConsumerSmallHeartbeatErr:                {Code: 400, ErrCode: 10083, Description: "consumer idle heartbeat needs to be >= 100ms"},
   531  		JSConsumerStoreFailedErrF:                  {Code: 500, ErrCode: 10104, Description: "error creating store for consumer: {err}"},
   532  		JSConsumerWQConsumerNotDeliverAllErr:       {Code: 400, ErrCode: 10101, Description: "consumer must be deliver all on workqueue stream"},
   533  		JSConsumerWQConsumerNotUniqueErr:           {Code: 400, ErrCode: 10100, Description: "filtered consumer not unique on workqueue stream"},
   534  		JSConsumerWQMultipleUnfilteredErr:          {Code: 400, ErrCode: 10099, Description: "multiple non-filtered consumers not allowed on workqueue stream"},
   535  		JSConsumerWQRequiresExplicitAckErr:         {Code: 400, ErrCode: 10098, Description: "workqueue stream requires explicit ack"},
   536  		JSConsumerWithFlowControlNeedsHeartbeats:   {Code: 400, ErrCode: 10108, Description: "consumer with flow control also needs heartbeats"},
   537  		JSInsufficientResourcesErr:                 {Code: 503, ErrCode: 10023, Description: "insufficient resources"},
   538  		JSInvalidJSONErr:                           {Code: 400, ErrCode: 10025, Description: "invalid JSON"},
   539  		JSMaximumConsumersLimitErr:                 {Code: 400, ErrCode: 10026, Description: "maximum consumers limit reached"},
   540  		JSMaximumStreamsLimitErr:                   {Code: 400, ErrCode: 10027, Description: "maximum number of streams reached"},
   541  		JSMemoryResourcesExceededErr:               {Code: 500, ErrCode: 10028, Description: "insufficient memory resources available"},
   542  		JSMirrorConsumerSetupFailedErrF:            {Code: 500, ErrCode: 10029, Description: "{err}"},
   543  		JSMirrorInvalidStreamName:                  {Code: 400, ErrCode: 10142, Description: "mirrored stream name is invalid"},
   544  		JSMirrorInvalidSubjectFilter:               {Code: 400, ErrCode: 10151, Description: "mirror subject filter is invalid"},
   545  		JSMirrorMaxMessageSizeTooBigErr:            {Code: 400, ErrCode: 10030, Description: "stream mirror must have max message size >= source"},
   546  		JSMirrorMultipleFiltersNotAllowed:          {Code: 400, ErrCode: 10150, Description: "mirror with multiple subject transforms cannot also have a single subject filter"},
   547  		JSMirrorOverlappingSubjectFilters:          {Code: 400, ErrCode: 10152, Description: "mirror subject filters can not overlap"},
   548  		JSMirrorWithFirstSeqErr:                    {Code: 400, ErrCode: 10143, Description: "stream mirrors can not have first sequence configured"},
   549  		JSMirrorWithSourcesErr:                     {Code: 400, ErrCode: 10031, Description: "stream mirrors can not also contain other sources"},
   550  		JSMirrorWithStartSeqAndTimeErr:             {Code: 400, ErrCode: 10032, Description: "stream mirrors can not have both start seq and start time configured"},
   551  		JSMirrorWithSubjectFiltersErr:              {Code: 400, ErrCode: 10033, Description: "stream mirrors can not contain filtered subjects"},
   552  		JSMirrorWithSubjectsErr:                    {Code: 400, ErrCode: 10034, Description: "stream mirrors can not contain subjects"},
   553  		JSNoAccountErr:                             {Code: 503, ErrCode: 10035, Description: "account not found"},
   554  		JSNoLimitsErr:                              {Code: 400, ErrCode: 10120, Description: "no JetStream default or applicable tiered limit present"},
   555  		JSNoMessageFoundErr:                        {Code: 404, ErrCode: 10037, Description: "no message found"},
   556  		JSNotEmptyRequestErr:                       {Code: 400, ErrCode: 10038, Description: "expected an empty request payload"},
   557  		JSNotEnabledErr:                            {Code: 503, ErrCode: 10076, Description: "JetStream not enabled"},
   558  		JSNotEnabledForAccountErr:                  {Code: 503, ErrCode: 10039, Description: "JetStream not enabled for account"},
   559  		JSPeerRemapErr:                             {Code: 503, ErrCode: 10075, Description: "peer remap failed"},
   560  		JSRaftGeneralErrF:                          {Code: 500, ErrCode: 10041, Description: "{err}"},
   561  		JSReplicasCountCannotBeNegative:            {Code: 400, ErrCode: 10133, Description: "replicas count cannot be negative"},
   562  		JSRestoreSubscribeFailedErrF:               {Code: 500, ErrCode: 10042, Description: "JetStream unable to subscribe to restore snapshot {subject}: {err}"},
   563  		JSSequenceNotFoundErrF:                     {Code: 400, ErrCode: 10043, Description: "sequence {seq} not found"},
   564  		JSSnapshotDeliverSubjectInvalidErr:         {Code: 400, ErrCode: 10015, Description: "deliver subject not valid"},
   565  		JSSourceConsumerSetupFailedErrF:            {Code: 500, ErrCode: 10045, Description: "{err}"},
   566  		JSSourceDuplicateDetected:                  {Code: 400, ErrCode: 10140, Description: "duplicate source configuration detected"},
   567  		JSSourceInvalidStreamName:                  {Code: 400, ErrCode: 10141, Description: "sourced stream name is invalid"},
   568  		JSSourceInvalidSubjectFilter:               {Code: 400, ErrCode: 10145, Description: "source subject filter is invalid"},
   569  		JSSourceInvalidTransformDestination:        {Code: 400, ErrCode: 10146, Description: "source transform destination is invalid"},
   570  		JSSourceMaxMessageSizeTooBigErr:            {Code: 400, ErrCode: 10046, Description: "stream source must have max message size >= target"},
   571  		JSSourceMultipleFiltersNotAllowed:          {Code: 400, ErrCode: 10144, Description: "source with multiple subject transforms cannot also have a single subject filter"},
   572  		JSSourceOverlappingSubjectFilters:          {Code: 400, ErrCode: 10147, Description: "source filters can not overlap"},
   573  		JSStorageResourcesExceededErr:              {Code: 500, ErrCode: 10047, Description: "insufficient storage resources available"},
   574  		JSStreamAssignmentErrF:                     {Code: 500, ErrCode: 10048, Description: "{err}"},
   575  		JSStreamCreateErrF:                         {Code: 500, ErrCode: 10049, Description: "{err}"},
   576  		JSStreamDeleteErrF:                         {Code: 500, ErrCode: 10050, Description: "{err}"},
   577  		JSStreamExternalApiOverlapErrF:             {Code: 400, ErrCode: 10021, Description: "stream external api prefix {prefix} must not overlap with {subject}"},
   578  		JSStreamExternalDelPrefixOverlapsErrF:      {Code: 400, ErrCode: 10022, Description: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"},
   579  		JSStreamGeneralErrorF:                      {Code: 500, ErrCode: 10051, Description: "{err}"},
   580  		JSStreamHeaderExceedsMaximumErr:            {Code: 400, ErrCode: 10097, Description: "header size exceeds maximum allowed of 64k"},
   581  		JSStreamInfoMaxSubjectsErr:                 {Code: 500, ErrCode: 10117, Description: "subject details would exceed maximum allowed"},
   582  		JSStreamInvalidConfigF:                     {Code: 500, ErrCode: 10052, Description: "{err}"},
   583  		JSStreamInvalidErr:                         {Code: 500, ErrCode: 10096, Description: "stream not valid"},
   584  		JSStreamInvalidExternalDeliverySubjErrF:    {Code: 400, ErrCode: 10024, Description: "stream external delivery prefix {prefix} must not contain wildcards"},
   585  		JSStreamLimitsErrF:                         {Code: 500, ErrCode: 10053, Description: "{err}"},
   586  		JSStreamMaxBytesRequired:                   {Code: 400, ErrCode: 10113, Description: "account requires a stream config to have max bytes set"},
   587  		JSStreamMaxStreamBytesExceeded:             {Code: 400, ErrCode: 10122, Description: "stream max bytes exceeds account limit max stream bytes"},
   588  		JSStreamMessageExceedsMaximumErr:           {Code: 400, ErrCode: 10054, Description: "message size exceeds maximum allowed"},
   589  		JSStreamMirrorNotUpdatableErr:              {Code: 400, ErrCode: 10055, Description: "stream mirror configuration can not be updated"},
   590  		JSStreamMismatchErr:                        {Code: 400, ErrCode: 10056, Description: "stream name in subject does not match request"},
   591  		JSStreamMoveAndScaleErr:                    {Code: 400, ErrCode: 10123, Description: "can not move and scale a stream in a single update"},
   592  		JSStreamMoveInProgressF:                    {Code: 400, ErrCode: 10124, Description: "stream move already in progress: {msg}"},
   593  		JSStreamMoveNotInProgress:                  {Code: 400, ErrCode: 10129, Description: "stream move not in progress"},
   594  		JSStreamMsgDeleteFailedF:                   {Code: 500, ErrCode: 10057, Description: "{err}"},
   595  		JSStreamNameContainsPathSeparatorsErr:      {Code: 400, ErrCode: 10128, Description: "Stream name can not contain path separators"},
   596  		JSStreamNameExistErr:                       {Code: 400, ErrCode: 10058, Description: "stream name already in use with a different configuration"},
   597  		JSStreamNameExistRestoreFailedErr:          {Code: 400, ErrCode: 10130, Description: "stream name already in use, cannot restore"},
   598  		JSStreamNotFoundErr:                        {Code: 404, ErrCode: 10059, Description: "stream not found"},
   599  		JSStreamNotMatchErr:                        {Code: 400, ErrCode: 10060, Description: "expected stream does not match"},
   600  		JSStreamOfflineErr:                         {Code: 500, ErrCode: 10118, Description: "stream is offline"},
   601  		JSStreamPurgeFailedF:                       {Code: 500, ErrCode: 10110, Description: "{err}"},
   602  		JSStreamReplicasNotSupportedErr:            {Code: 500, ErrCode: 10074, Description: "replicas > 1 not supported in non-clustered mode"},
   603  		JSStreamReplicasNotUpdatableErr:            {Code: 400, ErrCode: 10061, Description: "Replicas configuration can not be updated"},
   604  		JSStreamRestoreErrF:                        {Code: 500, ErrCode: 10062, Description: "restore failed: {err}"},
   605  		JSStreamRollupFailedF:                      {Code: 500, ErrCode: 10111, Description: "{err}"},
   606  		JSStreamSealedErr:                          {Code: 400, ErrCode: 10109, Description: "invalid operation on sealed stream"},
   607  		JSStreamSequenceNotMatchErr:                {Code: 503, ErrCode: 10063, Description: "expected stream sequence does not match"},
   608  		JSStreamSnapshotErrF:                       {Code: 500, ErrCode: 10064, Description: "snapshot failed: {err}"},
   609  		JSStreamStoreFailedF:                       {Code: 503, ErrCode: 10077, Description: "{err}"},
   610  		JSStreamSubjectOverlapErr:                  {Code: 400, ErrCode: 10065, Description: "subjects overlap with an existing stream"},
   611  		JSStreamTemplateCreateErrF:                 {Code: 500, ErrCode: 10066, Description: "{err}"},
   612  		JSStreamTemplateDeleteErrF:                 {Code: 500, ErrCode: 10067, Description: "{err}"},
   613  		JSStreamTemplateNotFoundErr:                {Code: 404, ErrCode: 10068, Description: "template not found"},
   614  		JSStreamUpdateErrF:                         {Code: 500, ErrCode: 10069, Description: "{err}"},
   615  		JSStreamWrongLastMsgIDErrF:                 {Code: 400, ErrCode: 10070, Description: "wrong last msg ID: {id}"},
   616  		JSStreamWrongLastSequenceErrF:              {Code: 400, ErrCode: 10071, Description: "wrong last sequence: {seq}"},
   617  		JSTempStorageFailedErr:                     {Code: 500, ErrCode: 10072, Description: "JetStream unable to open temp storage for restore"},
   618  		JSTemplateNameNotMatchSubjectErr:           {Code: 400, ErrCode: 10073, Description: "template name in subject does not match request"},
   619  	}
   620  	// ErrJetStreamNotClustered Deprecated by JSClusterNotActiveErr ApiError, use IsNatsError() for comparisons
   621  	ErrJetStreamNotClustered = ApiErrors[JSClusterNotActiveErr]
   622  	// ErrJetStreamNotAssigned Deprecated by JSClusterNotAssignedErr ApiError, use IsNatsError() for comparisons
   623  	ErrJetStreamNotAssigned = ApiErrors[JSClusterNotAssignedErr]
   624  	// ErrJetStreamNotLeader Deprecated by JSClusterNotLeaderErr ApiError, use IsNatsError() for comparisons
   625  	ErrJetStreamNotLeader = ApiErrors[JSClusterNotLeaderErr]
   626  	// ErrJetStreamConsumerAlreadyUsed Deprecated by JSConsumerNameExistErr ApiError, use IsNatsError() for comparisons
   627  	ErrJetStreamConsumerAlreadyUsed = ApiErrors[JSConsumerNameExistErr]
   628  	// ErrJetStreamResourcesExceeded Deprecated by JSInsufficientResourcesErr ApiError, use IsNatsError() for comparisons
   629  	ErrJetStreamResourcesExceeded = ApiErrors[JSInsufficientResourcesErr]
   630  	// ErrMemoryResourcesExceeded Deprecated by JSMemoryResourcesExceededErr ApiError, use IsNatsError() for comparisons
   631  	ErrMemoryResourcesExceeded = ApiErrors[JSMemoryResourcesExceededErr]
   632  	// ErrJetStreamNotEnabled Deprecated by JSNotEnabledErr ApiError, use IsNatsError() for comparisons
   633  	ErrJetStreamNotEnabled = ApiErrors[JSNotEnabledErr]
   634  	// ErrStorageResourcesExceeded Deprecated by JSStorageResourcesExceededErr ApiError, use IsNatsError() for comparisons
   635  	ErrStorageResourcesExceeded = ApiErrors[JSStorageResourcesExceededErr]
   636  	// ErrJetStreamStreamAlreadyUsed Deprecated by JSStreamNameExistErr ApiError, use IsNatsError() for comparisons
   637  	ErrJetStreamStreamAlreadyUsed = ApiErrors[JSStreamNameExistErr]
   638  	// ErrJetStreamStreamNotFound Deprecated by JSStreamNotFoundErr ApiError, use IsNatsError() for comparisons
   639  	ErrJetStreamStreamNotFound = ApiErrors[JSStreamNotFoundErr]
   640  	// ErrReplicasNotSupported Deprecated by JSStreamReplicasNotSupportedErr ApiError, use IsNatsError() for comparisons
   641  	ErrReplicasNotSupported = ApiErrors[JSStreamReplicasNotSupportedErr]
   642  )
   643  
   644  // NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
   645  func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
   646  	eopts := parseOpts(opts)
   647  	if ae, ok := eopts.err.(*ApiError); ok {
   648  		return ae
   649  	}
   650  
   651  	return ApiErrors[JSAccountResourcesExceededErr]
   652  }
   653  
   654  // NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
   655  func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
   656  	eopts := parseOpts(opts)
   657  	if ae, ok := eopts.err.(*ApiError); ok {
   658  		return ae
   659  	}
   660  
   661  	return ApiErrors[JSBadRequestErr]
   662  }
   663  
   664  // NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
   665  func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
   666  	eopts := parseOpts(opts)
   667  	if ae, ok := eopts.err.(*ApiError); ok {
   668  		return ae
   669  	}
   670  
   671  	return ApiErrors[JSClusterIncompleteErr]
   672  }
   673  
   674  // NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
   675  func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
   676  	eopts := parseOpts(opts)
   677  	if ae, ok := eopts.err.(*ApiError); ok {
   678  		return ae
   679  	}
   680  
   681  	e := ApiErrors[JSClusterNoPeersErrF]
   682  	args := e.toReplacerArgs([]interface{}{"{err}", err})
   683  	return &ApiError{
   684  		Code:        e.Code,
   685  		ErrCode:     e.ErrCode,
   686  		Description: strings.NewReplacer(args...).Replace(e.Description),
   687  	}
   688  }
   689  
   690  // NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
   691  func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
   692  	eopts := parseOpts(opts)
   693  	if ae, ok := eopts.err.(*ApiError); ok {
   694  		return ae
   695  	}
   696  
   697  	return ApiErrors[JSClusterNotActiveErr]
   698  }
   699  
   700  // NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
   701  func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
   702  	eopts := parseOpts(opts)
   703  	if ae, ok := eopts.err.(*ApiError); ok {
   704  		return ae
   705  	}
   706  
   707  	return ApiErrors[JSClusterNotAssignedErr]
   708  }
   709  
   710  // NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
   711  func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
   712  	eopts := parseOpts(opts)
   713  	if ae, ok := eopts.err.(*ApiError); ok {
   714  		return ae
   715  	}
   716  
   717  	return ApiErrors[JSClusterNotAvailErr]
   718  }
   719  
   720  // NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
   721  func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
   722  	eopts := parseOpts(opts)
   723  	if ae, ok := eopts.err.(*ApiError); ok {
   724  		return ae
   725  	}
   726  
   727  	return ApiErrors[JSClusterNotLeaderErr]
   728  }
   729  
   730  // NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
   731  func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
   732  	eopts := parseOpts(opts)
   733  	if ae, ok := eopts.err.(*ApiError); ok {
   734  		return ae
   735  	}
   736  
   737  	return ApiErrors[JSClusterPeerNotMemberErr]
   738  }
   739  
   740  // NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
   741  func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
   742  	eopts := parseOpts(opts)
   743  	if ae, ok := eopts.err.(*ApiError); ok {
   744  		return ae
   745  	}
   746  
   747  	return ApiErrors[JSClusterRequiredErr]
   748  }
   749  
   750  // NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
   751  func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
   752  	eopts := parseOpts(opts)
   753  	if ae, ok := eopts.err.(*ApiError); ok {
   754  		return ae
   755  	}
   756  
   757  	return ApiErrors[JSClusterServerNotMemberErr]
   758  }
   759  
   760  // NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
   761  func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
   762  	eopts := parseOpts(opts)
   763  	if ae, ok := eopts.err.(*ApiError); ok {
   764  		return ae
   765  	}
   766  
   767  	return ApiErrors[JSClusterTagsErr]
   768  }
   769  
   770  // NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
   771  func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
   772  	eopts := parseOpts(opts)
   773  	if ae, ok := eopts.err.(*ApiError); ok {
   774  		return ae
   775  	}
   776  
   777  	return ApiErrors[JSClusterUnSupportFeatureErr]
   778  }
   779  
   780  // NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
   781  func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
   782  	eopts := parseOpts(opts)
   783  	if ae, ok := eopts.err.(*ApiError); ok {
   784  		return ae
   785  	}
   786  
   787  	return ApiErrors[JSConsumerAlreadyExists]
   788  }
   789  
   790  // NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
   791  func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
   792  	eopts := parseOpts(opts)
   793  	if ae, ok := eopts.err.(*ApiError); ok {
   794  		return ae
   795  	}
   796  
   797  	return ApiErrors[JSConsumerBadDurableNameErr]
   798  }
   799  
   800  // NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
   801  func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
   802  	eopts := parseOpts(opts)
   803  	if ae, ok := eopts.err.(*ApiError); ok {
   804  		return ae
   805  	}
   806  
   807  	return ApiErrors[JSConsumerConfigRequiredErr]
   808  }
   809  
   810  // NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
   811  func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
   812  	eopts := parseOpts(opts)
   813  	if ae, ok := eopts.err.(*ApiError); ok {
   814  		return ae
   815  	}
   816  
   817  	return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
   818  }
   819  
   820  // NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
   821  func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
   822  	eopts := parseOpts(opts)
   823  	if ae, ok := eopts.err.(*ApiError); ok {
   824  		return ae
   825  	}
   826  
   827  	e := ApiErrors[JSConsumerCreateErrF]
   828  	args := e.toReplacerArgs([]interface{}{"{err}", err})
   829  	return &ApiError{
   830  		Code:        e.Code,
   831  		ErrCode:     e.ErrCode,
   832  		Description: strings.NewReplacer(args...).Replace(e.Description),
   833  	}
   834  }
   835  
   836  // NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
   837  func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
   838  	eopts := parseOpts(opts)
   839  	if ae, ok := eopts.err.(*ApiError); ok {
   840  		return ae
   841  	}
   842  
   843  	return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
   844  }
   845  
   846  // NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
   847  func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
   848  	eopts := parseOpts(opts)
   849  	if ae, ok := eopts.err.(*ApiError); ok {
   850  		return ae
   851  	}
   852  
   853  	return ApiErrors[JSConsumerDeliverCycleErr]
   854  }
   855  
   856  // NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
   857  func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
   858  	eopts := parseOpts(opts)
   859  	if ae, ok := eopts.err.(*ApiError); ok {
   860  		return ae
   861  	}
   862  
   863  	return ApiErrors[JSConsumerDeliverToWildcardsErr]
   864  }
   865  
   866  // NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
   867  func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
   868  	eopts := parseOpts(opts)
   869  	if ae, ok := eopts.err.(*ApiError); ok {
   870  		return ae
   871  	}
   872  
   873  	e := ApiErrors[JSConsumerDescriptionTooLongErrF]
   874  	args := e.toReplacerArgs([]interface{}{"{max}", max})
   875  	return &ApiError{
   876  		Code:        e.Code,
   877  		ErrCode:     e.ErrCode,
   878  		Description: strings.NewReplacer(args...).Replace(e.Description),
   879  	}
   880  }
   881  
   882  // NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
   883  func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
   884  	eopts := parseOpts(opts)
   885  	if ae, ok := eopts.err.(*ApiError); ok {
   886  		return ae
   887  	}
   888  
   889  	return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
   890  }
   891  
   892  // NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
   893  func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
   894  	eopts := parseOpts(opts)
   895  	if ae, ok := eopts.err.(*ApiError); ok {
   896  		return ae
   897  	}
   898  
   899  	return ApiErrors[JSConsumerDirectRequiresPushErr]
   900  }
   901  
   902  // NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
   903  func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
   904  	eopts := parseOpts(opts)
   905  	if ae, ok := eopts.err.(*ApiError); ok {
   906  		return ae
   907  	}
   908  
   909  	return ApiErrors[JSConsumerDoesNotExist]
   910  }
   911  
   912  // NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
   913  func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
   914  	eopts := parseOpts(opts)
   915  	if ae, ok := eopts.err.(*ApiError); ok {
   916  		return ae
   917  	}
   918  
   919  	return ApiErrors[JSConsumerDuplicateFilterSubjects]
   920  }
   921  
   922  // NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
   923  func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
   924  	eopts := parseOpts(opts)
   925  	if ae, ok := eopts.err.(*ApiError); ok {
   926  		return ae
   927  	}
   928  
   929  	return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
   930  }
   931  
   932  // NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
   933  func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
   934  	eopts := parseOpts(opts)
   935  	if ae, ok := eopts.err.(*ApiError); ok {
   936  		return ae
   937  	}
   938  
   939  	return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
   940  }
   941  
   942  // NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
   943  func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
   944  	eopts := parseOpts(opts)
   945  	if ae, ok := eopts.err.(*ApiError); ok {
   946  		return ae
   947  	}
   948  
   949  	return ApiErrors[JSConsumerDurableNameNotSetErr]
   950  }
   951  
   952  // NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
   953  func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
   954  	eopts := parseOpts(opts)
   955  	if ae, ok := eopts.err.(*ApiError); ok {
   956  		return ae
   957  	}
   958  
   959  	return ApiErrors[JSConsumerEmptyFilter]
   960  }
   961  
   962  // NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
   963  func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
   964  	eopts := parseOpts(opts)
   965  	if ae, ok := eopts.err.(*ApiError); ok {
   966  		return ae
   967  	}
   968  
   969  	return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
   970  }
   971  
   972  // NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
   973  func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
   974  	eopts := parseOpts(opts)
   975  	if ae, ok := eopts.err.(*ApiError); ok {
   976  		return ae
   977  	}
   978  
   979  	return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
   980  }
   981  
   982  // NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
   983  func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
   984  	eopts := parseOpts(opts)
   985  	if ae, ok := eopts.err.(*ApiError); ok {
   986  		return ae
   987  	}
   988  
   989  	return ApiErrors[JSConsumerExistingActiveErr]
   990  }
   991  
   992  // NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
   993  func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
   994  	eopts := parseOpts(opts)
   995  	if ae, ok := eopts.err.(*ApiError); ok {
   996  		return ae
   997  	}
   998  
   999  	return ApiErrors[JSConsumerFCRequiresPushErr]
  1000  }
  1001  
  1002  // NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
  1003  func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
  1004  	eopts := parseOpts(opts)
  1005  	if ae, ok := eopts.err.(*ApiError); ok {
  1006  		return ae
  1007  	}
  1008  
  1009  	return ApiErrors[JSConsumerFilterNotSubsetErr]
  1010  }
  1011  
  1012  // NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
  1013  func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
  1014  	eopts := parseOpts(opts)
  1015  	if ae, ok := eopts.err.(*ApiError); ok {
  1016  		return ae
  1017  	}
  1018  
  1019  	return ApiErrors[JSConsumerHBRequiresPushErr]
  1020  }
  1021  
  1022  // NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
  1023  func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
  1024  	eopts := parseOpts(opts)
  1025  	if ae, ok := eopts.err.(*ApiError); ok {
  1026  		return ae
  1027  	}
  1028  
  1029  	e := ApiErrors[JSConsumerInactiveThresholdExcess]
  1030  	args := e.toReplacerArgs([]interface{}{"{limit}", limit})
  1031  	return &ApiError{
  1032  		Code:        e.Code,
  1033  		ErrCode:     e.ErrCode,
  1034  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1035  	}
  1036  }
  1037  
  1038  // NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
  1039  func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
  1040  	eopts := parseOpts(opts)
  1041  	if ae, ok := eopts.err.(*ApiError); ok {
  1042  		return ae
  1043  	}
  1044  
  1045  	return ApiErrors[JSConsumerInvalidDeliverSubject]
  1046  }
  1047  
  1048  // NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
  1049  func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
  1050  	eopts := parseOpts(opts)
  1051  	if ae, ok := eopts.err.(*ApiError); ok {
  1052  		return ae
  1053  	}
  1054  
  1055  	e := ApiErrors[JSConsumerInvalidPolicyErrF]
  1056  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1057  	return &ApiError{
  1058  		Code:        e.Code,
  1059  		ErrCode:     e.ErrCode,
  1060  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1061  	}
  1062  }
  1063  
  1064  // NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
  1065  func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
  1066  	eopts := parseOpts(opts)
  1067  	if ae, ok := eopts.err.(*ApiError); ok {
  1068  		return ae
  1069  	}
  1070  
  1071  	e := ApiErrors[JSConsumerInvalidSamplingErrF]
  1072  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1073  	return &ApiError{
  1074  		Code:        e.Code,
  1075  		ErrCode:     e.ErrCode,
  1076  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1077  	}
  1078  }
  1079  
  1080  // NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
  1081  func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
  1082  	eopts := parseOpts(opts)
  1083  	if ae, ok := eopts.err.(*ApiError); ok {
  1084  		return ae
  1085  	}
  1086  
  1087  	return ApiErrors[JSConsumerMaxDeliverBackoffErr]
  1088  }
  1089  
  1090  // NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
  1091  func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
  1092  	eopts := parseOpts(opts)
  1093  	if ae, ok := eopts.err.(*ApiError); ok {
  1094  		return ae
  1095  	}
  1096  
  1097  	e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
  1098  	args := e.toReplacerArgs([]interface{}{"{limit}", limit})
  1099  	return &ApiError{
  1100  		Code:        e.Code,
  1101  		ErrCode:     e.ErrCode,
  1102  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1103  	}
  1104  }
  1105  
  1106  // NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
  1107  func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
  1108  	eopts := parseOpts(opts)
  1109  	if ae, ok := eopts.err.(*ApiError); ok {
  1110  		return ae
  1111  	}
  1112  
  1113  	return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
  1114  }
  1115  
  1116  // NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
  1117  func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
  1118  	eopts := parseOpts(opts)
  1119  	if ae, ok := eopts.err.(*ApiError); ok {
  1120  		return ae
  1121  	}
  1122  
  1123  	e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
  1124  	args := e.toReplacerArgs([]interface{}{"{limit}", limit})
  1125  	return &ApiError{
  1126  		Code:        e.Code,
  1127  		ErrCode:     e.ErrCode,
  1128  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1129  	}
  1130  }
  1131  
  1132  // NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
  1133  func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
  1134  	eopts := parseOpts(opts)
  1135  	if ae, ok := eopts.err.(*ApiError); ok {
  1136  		return ae
  1137  	}
  1138  
  1139  	return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
  1140  }
  1141  
  1142  // NewJSConsumerMaxRequestExpiresToSmallError creates a new JSConsumerMaxRequestExpiresToSmall error: "consumer max request expires needs to be >= 1ms"
  1143  func NewJSConsumerMaxRequestExpiresToSmallError(opts ...ErrorOption) *ApiError {
  1144  	eopts := parseOpts(opts)
  1145  	if ae, ok := eopts.err.(*ApiError); ok {
  1146  		return ae
  1147  	}
  1148  
  1149  	return ApiErrors[JSConsumerMaxRequestExpiresToSmall]
  1150  }
  1151  
  1152  // NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
  1153  func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
  1154  	eopts := parseOpts(opts)
  1155  	if ae, ok := eopts.err.(*ApiError); ok {
  1156  		return ae
  1157  	}
  1158  
  1159  	return ApiErrors[JSConsumerMaxWaitingNegativeErr]
  1160  }
  1161  
  1162  // NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
  1163  func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
  1164  	eopts := parseOpts(opts)
  1165  	if ae, ok := eopts.err.(*ApiError); ok {
  1166  		return ae
  1167  	}
  1168  
  1169  	e := ApiErrors[JSConsumerMetadataLengthErrF]
  1170  	args := e.toReplacerArgs([]interface{}{"{limit}", limit})
  1171  	return &ApiError{
  1172  		Code:        e.Code,
  1173  		ErrCode:     e.ErrCode,
  1174  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1175  	}
  1176  }
  1177  
  1178  // NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
  1179  func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
  1180  	eopts := parseOpts(opts)
  1181  	if ae, ok := eopts.err.(*ApiError); ok {
  1182  		return ae
  1183  	}
  1184  
  1185  	return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
  1186  }
  1187  
  1188  // NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
  1189  func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
  1190  	eopts := parseOpts(opts)
  1191  	if ae, ok := eopts.err.(*ApiError); ok {
  1192  		return ae
  1193  	}
  1194  
  1195  	return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
  1196  }
  1197  
  1198  // NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
  1199  func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
  1200  	eopts := parseOpts(opts)
  1201  	if ae, ok := eopts.err.(*ApiError); ok {
  1202  		return ae
  1203  	}
  1204  
  1205  	return ApiErrors[JSConsumerNameExistErr]
  1206  }
  1207  
  1208  // NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
  1209  func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
  1210  	eopts := parseOpts(opts)
  1211  	if ae, ok := eopts.err.(*ApiError); ok {
  1212  		return ae
  1213  	}
  1214  
  1215  	e := ApiErrors[JSConsumerNameTooLongErrF]
  1216  	args := e.toReplacerArgs([]interface{}{"{max}", max})
  1217  	return &ApiError{
  1218  		Code:        e.Code,
  1219  		ErrCode:     e.ErrCode,
  1220  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1221  	}
  1222  }
  1223  
  1224  // NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
  1225  func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
  1226  	eopts := parseOpts(opts)
  1227  	if ae, ok := eopts.err.(*ApiError); ok {
  1228  		return ae
  1229  	}
  1230  
  1231  	return ApiErrors[JSConsumerNotFoundErr]
  1232  }
  1233  
  1234  // NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
  1235  func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
  1236  	eopts := parseOpts(opts)
  1237  	if ae, ok := eopts.err.(*ApiError); ok {
  1238  		return ae
  1239  	}
  1240  
  1241  	return ApiErrors[JSConsumerOfflineErr]
  1242  }
  1243  
  1244  // NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
  1245  func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
  1246  	eopts := parseOpts(opts)
  1247  	if ae, ok := eopts.err.(*ApiError); ok {
  1248  		return ae
  1249  	}
  1250  
  1251  	return ApiErrors[JSConsumerOnMappedErr]
  1252  }
  1253  
  1254  // NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
  1255  func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
  1256  	eopts := parseOpts(opts)
  1257  	if ae, ok := eopts.err.(*ApiError); ok {
  1258  		return ae
  1259  	}
  1260  
  1261  	return ApiErrors[JSConsumerOverlappingSubjectFilters]
  1262  }
  1263  
  1264  // NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
  1265  func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
  1266  	eopts := parseOpts(opts)
  1267  	if ae, ok := eopts.err.(*ApiError); ok {
  1268  		return ae
  1269  	}
  1270  
  1271  	return ApiErrors[JSConsumerPullNotDurableErr]
  1272  }
  1273  
  1274  // NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires ack policy"
  1275  func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
  1276  	eopts := parseOpts(opts)
  1277  	if ae, ok := eopts.err.(*ApiError); ok {
  1278  		return ae
  1279  	}
  1280  
  1281  	return ApiErrors[JSConsumerPullRequiresAckErr]
  1282  }
  1283  
  1284  // NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
  1285  func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
  1286  	eopts := parseOpts(opts)
  1287  	if ae, ok := eopts.err.(*ApiError); ok {
  1288  		return ae
  1289  	}
  1290  
  1291  	return ApiErrors[JSConsumerPullWithRateLimitErr]
  1292  }
  1293  
  1294  // NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
  1295  func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
  1296  	eopts := parseOpts(opts)
  1297  	if ae, ok := eopts.err.(*ApiError); ok {
  1298  		return ae
  1299  	}
  1300  
  1301  	return ApiErrors[JSConsumerPushMaxWaitingErr]
  1302  }
  1303  
  1304  // NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
  1305  func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
  1306  	eopts := parseOpts(opts)
  1307  	if ae, ok := eopts.err.(*ApiError); ok {
  1308  		return ae
  1309  	}
  1310  
  1311  	return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
  1312  }
  1313  
  1314  // NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
  1315  func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
  1316  	eopts := parseOpts(opts)
  1317  	if ae, ok := eopts.err.(*ApiError); ok {
  1318  		return ae
  1319  	}
  1320  
  1321  	return ApiErrors[JSConsumerReplicasExceedsStream]
  1322  }
  1323  
  1324  // NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
  1325  func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
  1326  	eopts := parseOpts(opts)
  1327  	if ae, ok := eopts.err.(*ApiError); ok {
  1328  		return ae
  1329  	}
  1330  
  1331  	return ApiErrors[JSConsumerReplicasShouldMatchStream]
  1332  }
  1333  
  1334  // NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
  1335  func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
  1336  	eopts := parseOpts(opts)
  1337  	if ae, ok := eopts.err.(*ApiError); ok {
  1338  		return ae
  1339  	}
  1340  
  1341  	return ApiErrors[JSConsumerSmallHeartbeatErr]
  1342  }
  1343  
  1344  // NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
  1345  func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
  1346  	eopts := parseOpts(opts)
  1347  	if ae, ok := eopts.err.(*ApiError); ok {
  1348  		return ae
  1349  	}
  1350  
  1351  	e := ApiErrors[JSConsumerStoreFailedErrF]
  1352  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1353  	return &ApiError{
  1354  		Code:        e.Code,
  1355  		ErrCode:     e.ErrCode,
  1356  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1357  	}
  1358  }
  1359  
  1360  // NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
  1361  func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
  1362  	eopts := parseOpts(opts)
  1363  	if ae, ok := eopts.err.(*ApiError); ok {
  1364  		return ae
  1365  	}
  1366  
  1367  	return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
  1368  }
  1369  
  1370  // NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
  1371  func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
  1372  	eopts := parseOpts(opts)
  1373  	if ae, ok := eopts.err.(*ApiError); ok {
  1374  		return ae
  1375  	}
  1376  
  1377  	return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
  1378  }
  1379  
  1380  // NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
  1381  func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
  1382  	eopts := parseOpts(opts)
  1383  	if ae, ok := eopts.err.(*ApiError); ok {
  1384  		return ae
  1385  	}
  1386  
  1387  	return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
  1388  }
  1389  
  1390  // NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
  1391  func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
  1392  	eopts := parseOpts(opts)
  1393  	if ae, ok := eopts.err.(*ApiError); ok {
  1394  		return ae
  1395  	}
  1396  
  1397  	return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
  1398  }
  1399  
  1400  // NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
  1401  func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
  1402  	eopts := parseOpts(opts)
  1403  	if ae, ok := eopts.err.(*ApiError); ok {
  1404  		return ae
  1405  	}
  1406  
  1407  	return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
  1408  }
  1409  
  1410  // NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
  1411  func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
  1412  	eopts := parseOpts(opts)
  1413  	if ae, ok := eopts.err.(*ApiError); ok {
  1414  		return ae
  1415  	}
  1416  
  1417  	return ApiErrors[JSInsufficientResourcesErr]
  1418  }
  1419  
  1420  // NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON"
  1421  func NewJSInvalidJSONError(opts ...ErrorOption) *ApiError {
  1422  	eopts := parseOpts(opts)
  1423  	if ae, ok := eopts.err.(*ApiError); ok {
  1424  		return ae
  1425  	}
  1426  
  1427  	return ApiErrors[JSInvalidJSONErr]
  1428  }
  1429  
  1430  // NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
  1431  func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
  1432  	eopts := parseOpts(opts)
  1433  	if ae, ok := eopts.err.(*ApiError); ok {
  1434  		return ae
  1435  	}
  1436  
  1437  	return ApiErrors[JSMaximumConsumersLimitErr]
  1438  }
  1439  
  1440  // NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
  1441  func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
  1442  	eopts := parseOpts(opts)
  1443  	if ae, ok := eopts.err.(*ApiError); ok {
  1444  		return ae
  1445  	}
  1446  
  1447  	return ApiErrors[JSMaximumStreamsLimitErr]
  1448  }
  1449  
  1450  // NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
  1451  func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
  1452  	eopts := parseOpts(opts)
  1453  	if ae, ok := eopts.err.(*ApiError); ok {
  1454  		return ae
  1455  	}
  1456  
  1457  	return ApiErrors[JSMemoryResourcesExceededErr]
  1458  }
  1459  
  1460  // NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
  1461  func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
  1462  	eopts := parseOpts(opts)
  1463  	if ae, ok := eopts.err.(*ApiError); ok {
  1464  		return ae
  1465  	}
  1466  
  1467  	e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
  1468  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1469  	return &ApiError{
  1470  		Code:        e.Code,
  1471  		ErrCode:     e.ErrCode,
  1472  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1473  	}
  1474  }
  1475  
  1476  // NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
  1477  func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
  1478  	eopts := parseOpts(opts)
  1479  	if ae, ok := eopts.err.(*ApiError); ok {
  1480  		return ae
  1481  	}
  1482  
  1483  	return ApiErrors[JSMirrorInvalidStreamName]
  1484  }
  1485  
  1486  // NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror subject filter is invalid"
  1487  func NewJSMirrorInvalidSubjectFilterError(opts ...ErrorOption) *ApiError {
  1488  	eopts := parseOpts(opts)
  1489  	if ae, ok := eopts.err.(*ApiError); ok {
  1490  		return ae
  1491  	}
  1492  
  1493  	return ApiErrors[JSMirrorInvalidSubjectFilter]
  1494  }
  1495  
  1496  // NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
  1497  func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
  1498  	eopts := parseOpts(opts)
  1499  	if ae, ok := eopts.err.(*ApiError); ok {
  1500  		return ae
  1501  	}
  1502  
  1503  	return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
  1504  }
  1505  
  1506  // NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
  1507  func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
  1508  	eopts := parseOpts(opts)
  1509  	if ae, ok := eopts.err.(*ApiError); ok {
  1510  		return ae
  1511  	}
  1512  
  1513  	return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
  1514  }
  1515  
  1516  // NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
  1517  func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
  1518  	eopts := parseOpts(opts)
  1519  	if ae, ok := eopts.err.(*ApiError); ok {
  1520  		return ae
  1521  	}
  1522  
  1523  	return ApiErrors[JSMirrorOverlappingSubjectFilters]
  1524  }
  1525  
  1526  // NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
  1527  func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
  1528  	eopts := parseOpts(opts)
  1529  	if ae, ok := eopts.err.(*ApiError); ok {
  1530  		return ae
  1531  	}
  1532  
  1533  	return ApiErrors[JSMirrorWithFirstSeqErr]
  1534  }
  1535  
  1536  // NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
  1537  func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
  1538  	eopts := parseOpts(opts)
  1539  	if ae, ok := eopts.err.(*ApiError); ok {
  1540  		return ae
  1541  	}
  1542  
  1543  	return ApiErrors[JSMirrorWithSourcesErr]
  1544  }
  1545  
  1546  // NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
  1547  func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
  1548  	eopts := parseOpts(opts)
  1549  	if ae, ok := eopts.err.(*ApiError); ok {
  1550  		return ae
  1551  	}
  1552  
  1553  	return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
  1554  }
  1555  
  1556  // NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
  1557  func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
  1558  	eopts := parseOpts(opts)
  1559  	if ae, ok := eopts.err.(*ApiError); ok {
  1560  		return ae
  1561  	}
  1562  
  1563  	return ApiErrors[JSMirrorWithSubjectFiltersErr]
  1564  }
  1565  
  1566  // NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
  1567  func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
  1568  	eopts := parseOpts(opts)
  1569  	if ae, ok := eopts.err.(*ApiError); ok {
  1570  		return ae
  1571  	}
  1572  
  1573  	return ApiErrors[JSMirrorWithSubjectsErr]
  1574  }
  1575  
  1576  // NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
  1577  func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
  1578  	eopts := parseOpts(opts)
  1579  	if ae, ok := eopts.err.(*ApiError); ok {
  1580  		return ae
  1581  	}
  1582  
  1583  	return ApiErrors[JSNoAccountErr]
  1584  }
  1585  
  1586  // NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
  1587  func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
  1588  	eopts := parseOpts(opts)
  1589  	if ae, ok := eopts.err.(*ApiError); ok {
  1590  		return ae
  1591  	}
  1592  
  1593  	return ApiErrors[JSNoLimitsErr]
  1594  }
  1595  
  1596  // NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
  1597  func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
  1598  	eopts := parseOpts(opts)
  1599  	if ae, ok := eopts.err.(*ApiError); ok {
  1600  		return ae
  1601  	}
  1602  
  1603  	return ApiErrors[JSNoMessageFoundErr]
  1604  }
  1605  
  1606  // NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
  1607  func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
  1608  	eopts := parseOpts(opts)
  1609  	if ae, ok := eopts.err.(*ApiError); ok {
  1610  		return ae
  1611  	}
  1612  
  1613  	return ApiErrors[JSNotEmptyRequestErr]
  1614  }
  1615  
  1616  // NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
  1617  func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
  1618  	eopts := parseOpts(opts)
  1619  	if ae, ok := eopts.err.(*ApiError); ok {
  1620  		return ae
  1621  	}
  1622  
  1623  	return ApiErrors[JSNotEnabledErr]
  1624  }
  1625  
  1626  // NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
  1627  func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
  1628  	eopts := parseOpts(opts)
  1629  	if ae, ok := eopts.err.(*ApiError); ok {
  1630  		return ae
  1631  	}
  1632  
  1633  	return ApiErrors[JSNotEnabledForAccountErr]
  1634  }
  1635  
  1636  // NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
  1637  func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
  1638  	eopts := parseOpts(opts)
  1639  	if ae, ok := eopts.err.(*ApiError); ok {
  1640  		return ae
  1641  	}
  1642  
  1643  	return ApiErrors[JSPeerRemapErr]
  1644  }
  1645  
  1646  // NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
  1647  func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
  1648  	eopts := parseOpts(opts)
  1649  	if ae, ok := eopts.err.(*ApiError); ok {
  1650  		return ae
  1651  	}
  1652  
  1653  	e := ApiErrors[JSRaftGeneralErrF]
  1654  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1655  	return &ApiError{
  1656  		Code:        e.Code,
  1657  		ErrCode:     e.ErrCode,
  1658  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1659  	}
  1660  }
  1661  
  1662  // NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
  1663  func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
  1664  	eopts := parseOpts(opts)
  1665  	if ae, ok := eopts.err.(*ApiError); ok {
  1666  		return ae
  1667  	}
  1668  
  1669  	return ApiErrors[JSReplicasCountCannotBeNegative]
  1670  }
  1671  
  1672  // NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
  1673  func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
  1674  	eopts := parseOpts(opts)
  1675  	if ae, ok := eopts.err.(*ApiError); ok {
  1676  		return ae
  1677  	}
  1678  
  1679  	e := ApiErrors[JSRestoreSubscribeFailedErrF]
  1680  	args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
  1681  	return &ApiError{
  1682  		Code:        e.Code,
  1683  		ErrCode:     e.ErrCode,
  1684  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1685  	}
  1686  }
  1687  
  1688  // NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
  1689  func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
  1690  	eopts := parseOpts(opts)
  1691  	if ae, ok := eopts.err.(*ApiError); ok {
  1692  		return ae
  1693  	}
  1694  
  1695  	e := ApiErrors[JSSequenceNotFoundErrF]
  1696  	args := e.toReplacerArgs([]interface{}{"{seq}", seq})
  1697  	return &ApiError{
  1698  		Code:        e.Code,
  1699  		ErrCode:     e.ErrCode,
  1700  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1701  	}
  1702  }
  1703  
  1704  // NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
  1705  func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
  1706  	eopts := parseOpts(opts)
  1707  	if ae, ok := eopts.err.(*ApiError); ok {
  1708  		return ae
  1709  	}
  1710  
  1711  	return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
  1712  }
  1713  
  1714  // NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
  1715  func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
  1716  	eopts := parseOpts(opts)
  1717  	if ae, ok := eopts.err.(*ApiError); ok {
  1718  		return ae
  1719  	}
  1720  
  1721  	e := ApiErrors[JSSourceConsumerSetupFailedErrF]
  1722  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1723  	return &ApiError{
  1724  		Code:        e.Code,
  1725  		ErrCode:     e.ErrCode,
  1726  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1727  	}
  1728  }
  1729  
  1730  // NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
  1731  func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
  1732  	eopts := parseOpts(opts)
  1733  	if ae, ok := eopts.err.(*ApiError); ok {
  1734  		return ae
  1735  	}
  1736  
  1737  	return ApiErrors[JSSourceDuplicateDetected]
  1738  }
  1739  
  1740  // NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
  1741  func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
  1742  	eopts := parseOpts(opts)
  1743  	if ae, ok := eopts.err.(*ApiError); ok {
  1744  		return ae
  1745  	}
  1746  
  1747  	return ApiErrors[JSSourceInvalidStreamName]
  1748  }
  1749  
  1750  // NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source subject filter is invalid"
  1751  func NewJSSourceInvalidSubjectFilterError(opts ...ErrorOption) *ApiError {
  1752  	eopts := parseOpts(opts)
  1753  	if ae, ok := eopts.err.(*ApiError); ok {
  1754  		return ae
  1755  	}
  1756  
  1757  	return ApiErrors[JSSourceInvalidSubjectFilter]
  1758  }
  1759  
  1760  // NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform destination is invalid"
  1761  func NewJSSourceInvalidTransformDestinationError(opts ...ErrorOption) *ApiError {
  1762  	eopts := parseOpts(opts)
  1763  	if ae, ok := eopts.err.(*ApiError); ok {
  1764  		return ae
  1765  	}
  1766  
  1767  	return ApiErrors[JSSourceInvalidTransformDestination]
  1768  }
  1769  
  1770  // NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
  1771  func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
  1772  	eopts := parseOpts(opts)
  1773  	if ae, ok := eopts.err.(*ApiError); ok {
  1774  		return ae
  1775  	}
  1776  
  1777  	return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
  1778  }
  1779  
  1780  // NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
  1781  func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
  1782  	eopts := parseOpts(opts)
  1783  	if ae, ok := eopts.err.(*ApiError); ok {
  1784  		return ae
  1785  	}
  1786  
  1787  	return ApiErrors[JSSourceMultipleFiltersNotAllowed]
  1788  }
  1789  
  1790  // NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
  1791  func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
  1792  	eopts := parseOpts(opts)
  1793  	if ae, ok := eopts.err.(*ApiError); ok {
  1794  		return ae
  1795  	}
  1796  
  1797  	return ApiErrors[JSSourceOverlappingSubjectFilters]
  1798  }
  1799  
  1800  // NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
  1801  func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
  1802  	eopts := parseOpts(opts)
  1803  	if ae, ok := eopts.err.(*ApiError); ok {
  1804  		return ae
  1805  	}
  1806  
  1807  	return ApiErrors[JSStorageResourcesExceededErr]
  1808  }
  1809  
  1810  // NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
  1811  func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
  1812  	eopts := parseOpts(opts)
  1813  	if ae, ok := eopts.err.(*ApiError); ok {
  1814  		return ae
  1815  	}
  1816  
  1817  	e := ApiErrors[JSStreamAssignmentErrF]
  1818  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1819  	return &ApiError{
  1820  		Code:        e.Code,
  1821  		ErrCode:     e.ErrCode,
  1822  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1823  	}
  1824  }
  1825  
  1826  // NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
  1827  func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
  1828  	eopts := parseOpts(opts)
  1829  	if ae, ok := eopts.err.(*ApiError); ok {
  1830  		return ae
  1831  	}
  1832  
  1833  	e := ApiErrors[JSStreamCreateErrF]
  1834  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1835  	return &ApiError{
  1836  		Code:        e.Code,
  1837  		ErrCode:     e.ErrCode,
  1838  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1839  	}
  1840  }
  1841  
  1842  // NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
  1843  func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
  1844  	eopts := parseOpts(opts)
  1845  	if ae, ok := eopts.err.(*ApiError); ok {
  1846  		return ae
  1847  	}
  1848  
  1849  	e := ApiErrors[JSStreamDeleteErrF]
  1850  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1851  	return &ApiError{
  1852  		Code:        e.Code,
  1853  		ErrCode:     e.ErrCode,
  1854  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1855  	}
  1856  }
  1857  
  1858  // NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
  1859  func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
  1860  	eopts := parseOpts(opts)
  1861  	if ae, ok := eopts.err.(*ApiError); ok {
  1862  		return ae
  1863  	}
  1864  
  1865  	e := ApiErrors[JSStreamExternalApiOverlapErrF]
  1866  	args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
  1867  	return &ApiError{
  1868  		Code:        e.Code,
  1869  		ErrCode:     e.ErrCode,
  1870  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1871  	}
  1872  }
  1873  
  1874  // NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
  1875  func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
  1876  	eopts := parseOpts(opts)
  1877  	if ae, ok := eopts.err.(*ApiError); ok {
  1878  		return ae
  1879  	}
  1880  
  1881  	e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
  1882  	args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
  1883  	return &ApiError{
  1884  		Code:        e.Code,
  1885  		ErrCode:     e.ErrCode,
  1886  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1887  	}
  1888  }
  1889  
  1890  // NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
  1891  func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
  1892  	eopts := parseOpts(opts)
  1893  	if ae, ok := eopts.err.(*ApiError); ok {
  1894  		return ae
  1895  	}
  1896  
  1897  	e := ApiErrors[JSStreamGeneralErrorF]
  1898  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1899  	return &ApiError{
  1900  		Code:        e.Code,
  1901  		ErrCode:     e.ErrCode,
  1902  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1903  	}
  1904  }
  1905  
  1906  // NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
  1907  func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
  1908  	eopts := parseOpts(opts)
  1909  	if ae, ok := eopts.err.(*ApiError); ok {
  1910  		return ae
  1911  	}
  1912  
  1913  	return ApiErrors[JSStreamHeaderExceedsMaximumErr]
  1914  }
  1915  
  1916  // NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
  1917  func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
  1918  	eopts := parseOpts(opts)
  1919  	if ae, ok := eopts.err.(*ApiError); ok {
  1920  		return ae
  1921  	}
  1922  
  1923  	return ApiErrors[JSStreamInfoMaxSubjectsErr]
  1924  }
  1925  
  1926  // NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
  1927  func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
  1928  	eopts := parseOpts(opts)
  1929  	if ae, ok := eopts.err.(*ApiError); ok {
  1930  		return ae
  1931  	}
  1932  
  1933  	e := ApiErrors[JSStreamInvalidConfigF]
  1934  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1935  	return &ApiError{
  1936  		Code:        e.Code,
  1937  		ErrCode:     e.ErrCode,
  1938  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1939  	}
  1940  }
  1941  
  1942  // NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
  1943  func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
  1944  	eopts := parseOpts(opts)
  1945  	if ae, ok := eopts.err.(*ApiError); ok {
  1946  		return ae
  1947  	}
  1948  
  1949  	return ApiErrors[JSStreamInvalidErr]
  1950  }
  1951  
  1952  // NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
  1953  func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
  1954  	eopts := parseOpts(opts)
  1955  	if ae, ok := eopts.err.(*ApiError); ok {
  1956  		return ae
  1957  	}
  1958  
  1959  	e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
  1960  	args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
  1961  	return &ApiError{
  1962  		Code:        e.Code,
  1963  		ErrCode:     e.ErrCode,
  1964  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1965  	}
  1966  }
  1967  
  1968  // NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
  1969  func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
  1970  	eopts := parseOpts(opts)
  1971  	if ae, ok := eopts.err.(*ApiError); ok {
  1972  		return ae
  1973  	}
  1974  
  1975  	e := ApiErrors[JSStreamLimitsErrF]
  1976  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  1977  	return &ApiError{
  1978  		Code:        e.Code,
  1979  		ErrCode:     e.ErrCode,
  1980  		Description: strings.NewReplacer(args...).Replace(e.Description),
  1981  	}
  1982  }
  1983  
  1984  // NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
  1985  func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
  1986  	eopts := parseOpts(opts)
  1987  	if ae, ok := eopts.err.(*ApiError); ok {
  1988  		return ae
  1989  	}
  1990  
  1991  	return ApiErrors[JSStreamMaxBytesRequired]
  1992  }
  1993  
  1994  // NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
  1995  func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
  1996  	eopts := parseOpts(opts)
  1997  	if ae, ok := eopts.err.(*ApiError); ok {
  1998  		return ae
  1999  	}
  2000  
  2001  	return ApiErrors[JSStreamMaxStreamBytesExceeded]
  2002  }
  2003  
  2004  // NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
  2005  func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
  2006  	eopts := parseOpts(opts)
  2007  	if ae, ok := eopts.err.(*ApiError); ok {
  2008  		return ae
  2009  	}
  2010  
  2011  	return ApiErrors[JSStreamMessageExceedsMaximumErr]
  2012  }
  2013  
  2014  // NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
  2015  func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
  2016  	eopts := parseOpts(opts)
  2017  	if ae, ok := eopts.err.(*ApiError); ok {
  2018  		return ae
  2019  	}
  2020  
  2021  	return ApiErrors[JSStreamMirrorNotUpdatableErr]
  2022  }
  2023  
  2024  // NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
  2025  func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
  2026  	eopts := parseOpts(opts)
  2027  	if ae, ok := eopts.err.(*ApiError); ok {
  2028  		return ae
  2029  	}
  2030  
  2031  	return ApiErrors[JSStreamMismatchErr]
  2032  }
  2033  
  2034  // NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
  2035  func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
  2036  	eopts := parseOpts(opts)
  2037  	if ae, ok := eopts.err.(*ApiError); ok {
  2038  		return ae
  2039  	}
  2040  
  2041  	return ApiErrors[JSStreamMoveAndScaleErr]
  2042  }
  2043  
  2044  // NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
  2045  func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
  2046  	eopts := parseOpts(opts)
  2047  	if ae, ok := eopts.err.(*ApiError); ok {
  2048  		return ae
  2049  	}
  2050  
  2051  	e := ApiErrors[JSStreamMoveInProgressF]
  2052  	args := e.toReplacerArgs([]interface{}{"{msg}", msg})
  2053  	return &ApiError{
  2054  		Code:        e.Code,
  2055  		ErrCode:     e.ErrCode,
  2056  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2057  	}
  2058  }
  2059  
  2060  // NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
  2061  func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
  2062  	eopts := parseOpts(opts)
  2063  	if ae, ok := eopts.err.(*ApiError); ok {
  2064  		return ae
  2065  	}
  2066  
  2067  	return ApiErrors[JSStreamMoveNotInProgress]
  2068  }
  2069  
  2070  // NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
  2071  func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
  2072  	eopts := parseOpts(opts)
  2073  	if ae, ok := eopts.err.(*ApiError); ok {
  2074  		return ae
  2075  	}
  2076  
  2077  	e := ApiErrors[JSStreamMsgDeleteFailedF]
  2078  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2079  	return &ApiError{
  2080  		Code:        e.Code,
  2081  		ErrCode:     e.ErrCode,
  2082  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2083  	}
  2084  }
  2085  
  2086  // NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
  2087  func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
  2088  	eopts := parseOpts(opts)
  2089  	if ae, ok := eopts.err.(*ApiError); ok {
  2090  		return ae
  2091  	}
  2092  
  2093  	return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
  2094  }
  2095  
  2096  // NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
  2097  func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
  2098  	eopts := parseOpts(opts)
  2099  	if ae, ok := eopts.err.(*ApiError); ok {
  2100  		return ae
  2101  	}
  2102  
  2103  	return ApiErrors[JSStreamNameExistErr]
  2104  }
  2105  
  2106  // NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
  2107  func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
  2108  	eopts := parseOpts(opts)
  2109  	if ae, ok := eopts.err.(*ApiError); ok {
  2110  		return ae
  2111  	}
  2112  
  2113  	return ApiErrors[JSStreamNameExistRestoreFailedErr]
  2114  }
  2115  
  2116  // NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
  2117  func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
  2118  	eopts := parseOpts(opts)
  2119  	if ae, ok := eopts.err.(*ApiError); ok {
  2120  		return ae
  2121  	}
  2122  
  2123  	return ApiErrors[JSStreamNotFoundErr]
  2124  }
  2125  
  2126  // NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
  2127  func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
  2128  	eopts := parseOpts(opts)
  2129  	if ae, ok := eopts.err.(*ApiError); ok {
  2130  		return ae
  2131  	}
  2132  
  2133  	return ApiErrors[JSStreamNotMatchErr]
  2134  }
  2135  
  2136  // NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
  2137  func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
  2138  	eopts := parseOpts(opts)
  2139  	if ae, ok := eopts.err.(*ApiError); ok {
  2140  		return ae
  2141  	}
  2142  
  2143  	return ApiErrors[JSStreamOfflineErr]
  2144  }
  2145  
  2146  // NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
  2147  func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
  2148  	eopts := parseOpts(opts)
  2149  	if ae, ok := eopts.err.(*ApiError); ok {
  2150  		return ae
  2151  	}
  2152  
  2153  	e := ApiErrors[JSStreamPurgeFailedF]
  2154  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2155  	return &ApiError{
  2156  		Code:        e.Code,
  2157  		ErrCode:     e.ErrCode,
  2158  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2159  	}
  2160  }
  2161  
  2162  // NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
  2163  func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
  2164  	eopts := parseOpts(opts)
  2165  	if ae, ok := eopts.err.(*ApiError); ok {
  2166  		return ae
  2167  	}
  2168  
  2169  	return ApiErrors[JSStreamReplicasNotSupportedErr]
  2170  }
  2171  
  2172  // NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
  2173  func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
  2174  	eopts := parseOpts(opts)
  2175  	if ae, ok := eopts.err.(*ApiError); ok {
  2176  		return ae
  2177  	}
  2178  
  2179  	return ApiErrors[JSStreamReplicasNotUpdatableErr]
  2180  }
  2181  
  2182  // NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
  2183  func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
  2184  	eopts := parseOpts(opts)
  2185  	if ae, ok := eopts.err.(*ApiError); ok {
  2186  		return ae
  2187  	}
  2188  
  2189  	e := ApiErrors[JSStreamRestoreErrF]
  2190  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2191  	return &ApiError{
  2192  		Code:        e.Code,
  2193  		ErrCode:     e.ErrCode,
  2194  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2195  	}
  2196  }
  2197  
  2198  // NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
  2199  func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
  2200  	eopts := parseOpts(opts)
  2201  	if ae, ok := eopts.err.(*ApiError); ok {
  2202  		return ae
  2203  	}
  2204  
  2205  	e := ApiErrors[JSStreamRollupFailedF]
  2206  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2207  	return &ApiError{
  2208  		Code:        e.Code,
  2209  		ErrCode:     e.ErrCode,
  2210  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2211  	}
  2212  }
  2213  
  2214  // NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
  2215  func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
  2216  	eopts := parseOpts(opts)
  2217  	if ae, ok := eopts.err.(*ApiError); ok {
  2218  		return ae
  2219  	}
  2220  
  2221  	return ApiErrors[JSStreamSealedErr]
  2222  }
  2223  
  2224  // NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
  2225  func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
  2226  	eopts := parseOpts(opts)
  2227  	if ae, ok := eopts.err.(*ApiError); ok {
  2228  		return ae
  2229  	}
  2230  
  2231  	return ApiErrors[JSStreamSequenceNotMatchErr]
  2232  }
  2233  
  2234  // NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
  2235  func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
  2236  	eopts := parseOpts(opts)
  2237  	if ae, ok := eopts.err.(*ApiError); ok {
  2238  		return ae
  2239  	}
  2240  
  2241  	e := ApiErrors[JSStreamSnapshotErrF]
  2242  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2243  	return &ApiError{
  2244  		Code:        e.Code,
  2245  		ErrCode:     e.ErrCode,
  2246  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2247  	}
  2248  }
  2249  
  2250  // NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
  2251  func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
  2252  	eopts := parseOpts(opts)
  2253  	if ae, ok := eopts.err.(*ApiError); ok {
  2254  		return ae
  2255  	}
  2256  
  2257  	e := ApiErrors[JSStreamStoreFailedF]
  2258  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2259  	return &ApiError{
  2260  		Code:        e.Code,
  2261  		ErrCode:     e.ErrCode,
  2262  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2263  	}
  2264  }
  2265  
  2266  // NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
  2267  func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
  2268  	eopts := parseOpts(opts)
  2269  	if ae, ok := eopts.err.(*ApiError); ok {
  2270  		return ae
  2271  	}
  2272  
  2273  	return ApiErrors[JSStreamSubjectOverlapErr]
  2274  }
  2275  
  2276  // NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
  2277  func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
  2278  	eopts := parseOpts(opts)
  2279  	if ae, ok := eopts.err.(*ApiError); ok {
  2280  		return ae
  2281  	}
  2282  
  2283  	e := ApiErrors[JSStreamTemplateCreateErrF]
  2284  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2285  	return &ApiError{
  2286  		Code:        e.Code,
  2287  		ErrCode:     e.ErrCode,
  2288  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2289  	}
  2290  }
  2291  
  2292  // NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
  2293  func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
  2294  	eopts := parseOpts(opts)
  2295  	if ae, ok := eopts.err.(*ApiError); ok {
  2296  		return ae
  2297  	}
  2298  
  2299  	e := ApiErrors[JSStreamTemplateDeleteErrF]
  2300  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2301  	return &ApiError{
  2302  		Code:        e.Code,
  2303  		ErrCode:     e.ErrCode,
  2304  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2305  	}
  2306  }
  2307  
  2308  // NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
  2309  func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
  2310  	eopts := parseOpts(opts)
  2311  	if ae, ok := eopts.err.(*ApiError); ok {
  2312  		return ae
  2313  	}
  2314  
  2315  	return ApiErrors[JSStreamTemplateNotFoundErr]
  2316  }
  2317  
  2318  // NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
  2319  func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
  2320  	eopts := parseOpts(opts)
  2321  	if ae, ok := eopts.err.(*ApiError); ok {
  2322  		return ae
  2323  	}
  2324  
  2325  	e := ApiErrors[JSStreamUpdateErrF]
  2326  	args := e.toReplacerArgs([]interface{}{"{err}", err})
  2327  	return &ApiError{
  2328  		Code:        e.Code,
  2329  		ErrCode:     e.ErrCode,
  2330  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2331  	}
  2332  }
  2333  
  2334  // NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
  2335  func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
  2336  	eopts := parseOpts(opts)
  2337  	if ae, ok := eopts.err.(*ApiError); ok {
  2338  		return ae
  2339  	}
  2340  
  2341  	e := ApiErrors[JSStreamWrongLastMsgIDErrF]
  2342  	args := e.toReplacerArgs([]interface{}{"{id}", id})
  2343  	return &ApiError{
  2344  		Code:        e.Code,
  2345  		ErrCode:     e.ErrCode,
  2346  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2347  	}
  2348  }
  2349  
  2350  // NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
  2351  func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
  2352  	eopts := parseOpts(opts)
  2353  	if ae, ok := eopts.err.(*ApiError); ok {
  2354  		return ae
  2355  	}
  2356  
  2357  	e := ApiErrors[JSStreamWrongLastSequenceErrF]
  2358  	args := e.toReplacerArgs([]interface{}{"{seq}", seq})
  2359  	return &ApiError{
  2360  		Code:        e.Code,
  2361  		ErrCode:     e.ErrCode,
  2362  		Description: strings.NewReplacer(args...).Replace(e.Description),
  2363  	}
  2364  }
  2365  
  2366  // NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
  2367  func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
  2368  	eopts := parseOpts(opts)
  2369  	if ae, ok := eopts.err.(*ApiError); ok {
  2370  		return ae
  2371  	}
  2372  
  2373  	return ApiErrors[JSTempStorageFailedErr]
  2374  }
  2375  
  2376  // NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
  2377  func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
  2378  	eopts := parseOpts(opts)
  2379  	if ae, ok := eopts.err.(*ApiError); ok {
  2380  		return ae
  2381  	}
  2382  
  2383  	return ApiErrors[JSTemplateNameNotMatchSubjectErr]
  2384  }