{"record":{"id":"4bfd4a38fa474485","repo":"pulumi/pulumi","slug":"failed-to-serialize-configuration-w","errorCode":null,"errorMessage":"failed to serialize configuration: %w","messagePattern":"failed to serialize configuration: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/nodejs/cmd/pulumi-language-nodejs/main.go","lineNumber":903,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn &pulumirpc.RunResponse{Error: err.Error()}, nil\n\t\t\t}\n\t\tcase response := <-responseChannel:\n\t\t\treturn response, nil\n\t\t}\n\t}\n}\n\n// Launch the runtime process and wait for it to complete.  Report success or any errors using the\n// `responseChannel` arg.\nfunc (host *nodeLanguageHost) execRuntime(ctx context.Context, req *pulumirpc.RunRequest,\n\tengineClient pulumirpc.EngineClient, runtimeBin, runPath, address, pipesDirectory string,\n) *pulumirpc.RunResponse {\n\t// Actually launch nodejs or bun and process the result of it into an appropriate response object.\n\targs := host.constructArguments(req, runPath, address, pipesDirectory)\n\tconfig, err := host.constructConfig(req)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to serialize configuration: %w\", err)\n\t\treturn &pulumirpc.RunResponse{Error: err.Error()}\n\t}\n\tconfigSecretKeys, err := host.constructConfigSecretKeys(req)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to serialize configuration secret keys: %w\", err)\n\t\treturn &pulumirpc.RunResponse{Error: err.Error()}\n\t}\n\n\tenv := os.Environ()\n\tenv = append(env, pulumiConfigVar+\"=\"+config)\n\tenv = append(env, pulumiConfigSecretKeysVar+\"=\"+configSecretKeys)\n\n\topts, err := parseOptions(req.Info.Options.AsMap(), host.runtime)\n\tif err != nil {\n\t\treturn &pulumirpc.RunResponse{Error: err.Error()}\n\t}\n\n\tif opts.typescript {","sourceCodeStart":885,"sourceCodeEnd":921,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/nodejs/cmd/pulumi-language-nodejs/main.go#L885-L921","documentation":"The Pulumi NodeJS language host failed to JSON-serialize the stack configuration before launching the user's program process (constructConfig in main.go:1120). The error is wrapped with this message and returned to the engine inside RunResponse.Error instead of the program being run. This almost always means a config key in the RunRequest could not be parsed by config.ParseKey, i.e. it is malformed.","triggerScenarios":"LanguageRuntime.Run RPC is invoked with req.Config containing a key that fails config.ParseKey (does not look like '<namespace>:<name>' with a valid namespace/name), or json.Marshal of the transformed config map fails. The failing call is host.constructConfig(req) at sdk/nodejs/cmd/pulumi-language-nodejs/main.go:901.","commonSituations":"Config entries written with malformed keys (e.g. 'foo' without a project/package prefix, empty names, or invalid characters) such as when setting config manually or via automation API; mismatches between old (<pkg>:config:<name>) and new config key formats; corrupted stack state config bags.","solutions":["Find the offending key in the error detail and fix it with `pulumi config set <project>:<name> <value>` using a valid '<package>:<name>' key format.","Run `pulumi config` to list all keys for the stack and remove/rename malformed entries with `pulumi config rm`.","Ensure all pulumi CLI and @pulumi/pulumi SDK versions are current, since config key format transition bugs were fixed over time.","If using automation API, validate config key strings before passing them to LocalWorkspace program runs."],"exampleFix":"// before: malformed key set directly\npulumi config set mykey value\n\n// after: fully-qualified key\npulumi config set myproject:mykey value","handlingStrategy":"validation","validationCode":"// Validate config keys before running pulumi\nfor key in $(pulumi config --show-secrets --json | jq -r 'keys[]'); do\n  if ! echo \"$key\" | grep -qE '^[^:]+:[^:]+'; then\n    echo \"Malformed config key: $key\"; exit 1\n  fi\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set config with fully-qualified keys: `pulumi config set <project>:<name> <value>`.","Audit stack config with `pulumi config` in CI before deployments.","Keep pulumi CLI and @pulumi/pulumi versions in sync."],"tags":["nodejs","config","serialization","language-host"],"backgroundTag":"config-key-parse-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}