{"record":{"id":"259e3510896b8917","repo":"apache/beam","slug":"error-creating-growable-tracker-v","errorCode":null,"errorMessage":"error creating growable tracker: %v","messagePattern":"error creating growable tracker: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/natsio/read.go","lineNumber":250,"sourceCode":"\t\t\treturn sdf.StopProcessing(), fmt.Errorf(\"error in message batch: %v\", err)\n\t\t}\n\n\t\tif count == 0 {\n\t\t\tfn.updateWatermarkManually(we)\n\t\t\treturn sdf.ResumeProcessingIn(resumeDelay), nil\n\t\t}\n\t}\n}\n\nfunc (fn *readFn) createRTracker(rest offsetrange.Restriction) (sdf.RTracker, error) {\n\tif rest.End < math.MaxInt64 {\n\t\treturn offsetrange.NewTracker(rest), nil\n\t}\n\n\testimator := newEndEstimator(fn.js, fn.Stream, fn.Subject)\n\trt, err := offsetrange.NewGrowableTracker(rest, estimator)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating growable tracker: %v\", err)\n\t}\n\n\treturn rt, nil\n}\n\nfunc (fn *readFn) createConsumer(\n\tctx context.Context,\n\tstartSeqNo int64,\n) (jetstream.Consumer, error) {\n\tcfg := jetstream.OrderedConsumerConfig{\n\t\tFilterSubjects:   []string{fn.Subject},\n\t\tDeliverPolicy:    jetstream.DeliverByStartSequencePolicy,\n\t\tOptStartSeq:      uint64(startSeqNo),\n\t\tMaxResetAttempts: 5,\n\t}\n\n\tcons, err := fn.js.OrderedConsumer(ctx, fn.Stream, cfg)\n\tif err != nil {","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/natsio/read.go#L232-L268","documentation":"Returned by readFn.createRTracker (used by RestrictionSize and CreateTracker) when offsetrange.NewGrowableTracker fails to construct a growable restriction tracker for an unbounded restriction (End == math.MaxInt64). The growable tracker needs an end-estimator callback into JetStream; construction fails if the estimator cannot be set up, typically because the JetStream context (fn.js) is nil or the stream/subject is invalid.","triggerScenarios":"natsio.Read called with EndSeqNo left at default math.MaxInt64 AND fn.js is nil (Setup/connection failed earlier) or newEndEstimator's stream/subject references don't resolve, so offsetrange.NewGrowableTracker returns an error at read.go:248.","commonSituations":"Passing an invalid URI or bad credentials so the NATS connection/JetStream context was never established; typos in the stream name used both for the consumer and the end estimator; calling RestrictionSize before Setup on a worker where the connection never initialized.","solutions":["Fix the NATS URI/credentials so natsFn.Setup succeeds and fn.js is non-nil before tracker creation.","Verify the stream name passed to natsio.Read exists (nats stream list); an unknown stream breaks the end estimator.","Confirm the subject filter matches at least the stream's subjects (nats stream info <stream> subjects).","If you only need bounded reads, set the EndSeqNo option below math.MaxInt64 so a plain static tracker is used and no estimator is needed."],"exampleFix":"// before\npc := natsio.Read(s, uri, stream, subject)\n// after\npc := natsio.Read(s, uri, stream, subject,\n  natsio.EndSeqNo(1000)) // bounded: avoids growable tracker + end estimator entirely","handlingStrategy":"validation","validationCode":"// validate before Read()\njs, err := jetstream.New(nc)\nif err != nil { return err }\nif _, err := js.StreamInfo(ctx, stream); err != nil {\n    return fmt.Errorf(\"cannot resolve stream %q for end estimator: %w\", stream, err)\n}\nif subject == \"\" { return errors.New(\"subject must be non-empty\") }","typeGuard":null,"tryCatchPattern":"rt, err := offsetrange.NewGrowableTracker(rest, estimator)\nif err != nil {\n    // fall back to a bounded static tracker for a conservative window\n    return offsetrange.NewTracker(offsetrange.Restriction{Start: rest.Start, End: rest.Start + 1_000_000}), nil\n}","preventionTips":["Ensure the NATS connection succeeds at Setup before unbounded reads (check URI/creds)","Validate stream and subject names against `nats stream info` before launching","Set an explicit EndSeqNo when you know the data range to avoid the growable tracker entirely","Keep one shared JetStream context instance so fn.js is never nil"],"tags":["nats","jetstream","restriction-tracker","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}