{"record":{"id":"739d2b3050978e42","repo":"nats-io/nats-server","slug":"could-not-add-shadow-import-subscription-for-accou","errorCode":null,"errorMessage":"Could not add shadow import subscription for account %q","messagePattern":"Could not add shadow import subscription for account %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/client.go","lineNumber":3340,"sourceCode":"\t\t}\n\t\tsubj := im.rtr.TransformSubject(s)\n\n\t\tnsub.subject = []byte(subj)\n\t} else if !im.usePub || (im.usePub && ime.overlapSubj != _EMPTY_) || !ime.dyn {\n\t\tif ime.overlapSubj != _EMPTY_ {\n\t\t\tnsub.subject = []byte(ime.overlapSubj)\n\t\t} else {\n\t\t\tnsub.subject = []byte(im.from)\n\t\t}\n\t}\n\t// Else use original subject\n\n\tc.Debugf(\"Creating import subscription on %q from account %q\", nsub.subject, im.acc.Name)\n\n\tif err := im.acc.sl.Insert(&nsub); err != nil {\n\t\terrs := fmt.Sprintf(\"Could not add shadow import subscription for account %q\", im.acc.Name)\n\t\tc.Debugf(errs)\n\t\treturn nil, errors.New(errs)\n\t}\n\n\t// Update our route map here. But only if we are not a leaf node or a hub leafnode.\n\tif c.kind != LEAF || c.isHubLeafNode() {\n\t\tc.srv.updateRemoteSubscription(im.acc, &nsub, 1)\n\t} else if c.kind == LEAF {\n\t\t// Update all leafnodes that connect to this server. Note that we could have\n\t\t// used the updateLeafNodes() function since when it does invoke updateSmap()\n\t\t// this function already takes care of not sending to a spoke leafnode since\n\t\t// the `nsub` here is already from a spoke leafnode, but to be explicit, we\n\t\t// use this version that updates only leafnodes that connect to this server.\n\t\tim.acc.updateLeafNodesEx(&nsub, 1, true)\n\t}\n\n\treturn &nsub, nil\n}\n\n// canSubscribeInternal determines if the client is authorized to subscribe to","sourceCodeStart":3322,"sourceCodeEnd":3358,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/client.go#L3322-L3358","documentation":"Internal runtime error in account import processing: inserting the shadow subscription (the internal sub that realizes an account's imported subject) into the account sublist failed for account %q. Not a client input error — it signals an unexpected sublist Insert failure (e.g. invalid generated or duplicate subject) while wiring imports.","triggerScenarios":"Thrown at server/client.go:3340 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the account's imports for conflicting or overlapping subjects","Check server debug logs for the account name in the message to locate the failing import","Re-apply the account claim or import definitions if state is stale"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}