pulumi/pulumi · error
failed to serialize configuration: %w
Error message
failed to serialize configuration: %w
What it means
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.
Source
Thrown at sdk/nodejs/cmd/pulumi-language-nodejs/main.go:903
if err != nil {
return &pulumirpc.RunResponse{Error: err.Error()}, nil
}
case response := <-responseChannel:
return response, nil
}
}
}
// Launch the runtime process and wait for it to complete. Report success or any errors using the
// `responseChannel` arg.
func (host *nodeLanguageHost) execRuntime(ctx context.Context, req *pulumirpc.RunRequest,
engineClient pulumirpc.EngineClient, runtimeBin, runPath, address, pipesDirectory string,
) *pulumirpc.RunResponse {
// Actually launch nodejs or bun and process the result of it into an appropriate response object.
args := host.constructArguments(req, runPath, address, pipesDirectory)
config, err := host.constructConfig(req)
if err != nil {
err = fmt.Errorf("failed to serialize configuration: %w", err)
return &pulumirpc.RunResponse{Error: err.Error()}
}
configSecretKeys, err := host.constructConfigSecretKeys(req)
if err != nil {
err = fmt.Errorf("failed to serialize configuration secret keys: %w", err)
return &pulumirpc.RunResponse{Error: err.Error()}
}
env := os.Environ()
env = append(env, pulumiConfigVar+"="+config)
env = append(env, pulumiConfigSecretKeysVar+"="+configSecretKeys)
opts, err := parseOptions(req.Info.Options.AsMap(), host.runtime)
if err != nil {
return &pulumirpc.RunResponse{Error: err.Error()}
}
if opts.typescript {View on GitHub (pinned to 793f7b2e16)
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.
Example fix
// before: malformed key set directly pulumi config set mykey value // after: fully-qualified key pulumi config set myproject:mykey value
Defensive patterns
Strategy: validation
Validate before calling
// Validate config keys before running pulumi
for key in $(pulumi config --show-secrets --json | jq -r 'keys[]'); do
if ! echo "$key" | grep -qE '^[^:]+:[^:]+'; then
echo "Malformed config key: $key"; exit 1
fi
done Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to serialize configuration secret keys: %w
- could not marshal stack configuration: %w
- unsupported runtime: %s
- could not start health check host RPC server: %w
- could not start language host RPC server: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/4bfd4a38fa474485.
Report an issue: GitHub.