{"record":{"id":"5b7c75daff2bcbbb","repo":"risingwavelabs/risingwave","slug":"failed-to-parse-static-creds","errorCode":null,"errorMessage":"failed to parse static creds","messagePattern":"failed to parse static creds","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/connector_common/common.rs","lineNumber":1065,"sourceCode":"        match self.connect_mode.as_str() {\n            \"user_and_password\" => {\n                if let (Some(v_user), Some(v_password)) =\n                    (self.user.as_ref(), self.password.as_ref())\n                {\n                    connect_options =\n                        connect_options.user_and_password(v_user.into(), v_password.into())\n                } else {\n                    bail!(\n                        \"NATS connect mode `user_and_password` requires both `user` and `password`\"\n                    );\n                }\n            }\n\n            \"credential\" => {\n                if let (Some(v_nkey), Some(v_jwt)) = (self.nkey.as_ref(), self.jwt.as_ref()) {\n                    connect_options = connect_options\n                        .credentials(&self.create_credential(v_nkey, v_jwt)?)\n                        .expect(\"failed to parse static creds\")\n                } else {\n                    bail!(\"NATS connect mode `credential` requires both `nkey` and `jwt`\");\n                }\n            }\n            \"plain\" => {}\n            _ => {\n                bail!(\n                    \"NATS connect mode must be one of `user_and_password`, `credential`, or `plain`\"\n                );\n            }\n        };\n\n        let servers = self.server_url.split(',').collect::<Vec<&str>>();\n        let client = connect_options\n            .connect(\n                servers\n                    .iter()\n                    .map(|url| url.parse())","sourceCodeStart":1047,"sourceCodeEnd":1083,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/connector_common/common.rs#L1047-L1083","documentation":"Not a bail but an `.expect(\"failed to parse static creds\")` panic path: after `create_credential` succeeds building a NATS static credential from nkey+jwt, `connect_options.credentials(...)` returned None, meaning the connect options rejected the credential. This indicates an internal inconsistency or incompatible async-nats version rather than user input error.","triggerScenarios":"NATS `credential` connect mode with valid nkey and jwt where the async-nats `ConnectOptions::credentials` call unexpectedly returns None — typically an async-nats version/API mismatch or a credential the builder cannot accept.","commonSituations":"Workspace dependency upgrade of async-nats changing behavior of `credentials()`; constructing a credential whose format the installed client cannot consume.","solutions":["Check the async-nats crate version matches what RisingWave expects (Cargo.lock) and rebuild.","Regenerate the nkey/jwt pair with the NATS CLI (`nsc`) and verify it with `nats` client login.","If reproducible, report as a bug — this expect indicates an internal invariant violation, not user error."],"exampleFix":"// before\ncargo update -p async-nats  // may pull incompatible version\n// after\ncargo update -p async-nats --precise <version-pinned-in-lockfile>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await createNatsSink(opts); } catch (e) {\n  if (e.name === 'PanicError' || String(e).includes('failed to parse static creds')) {\n    // async-nats rejected a well-formed credential; check versions and regenerate creds\n    await verifyAsyncNatsVersion();\n    throw new Error('Static NATS credential rejected by client; regenerate nkey/jwt or pin async-nats version');\n  }\n  throw e;\n}","preventionTips":["Pin the async-nats dependency version and avoid unreviewed upgrades.","Regenerate nkey/jwt with a current nsc CLI when this panic appears.","Treat this panic as a bug report signal, not a config problem."],"tags":["nats","credentials","panic","internal"],"backgroundTag":"internal-invariant-violation","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}