{"record":{"id":"63804d541723bc19","repo":"pulumi/pulumi","slug":"error-serializing-property-k-string-err","errorCode":null,"errorMessage":"error serializing property \"${k}\": ${String(err)}","messagePattern":"error serializing property \"(.+?)\": (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdk/nodejs/runtime/rpc.ts","lineNumber":195,"sourceCode":"    for (const k of Object.keys(props)) {\n        if (acceptKey(k)) {\n            if (opts?.pendingRegistration !== undefined) {\n                opts.pendingRegistration.inputProperty = k;\n            }\n            // We treat properties with undefined values as if they do not exist.\n            const dependentResources = new Set<Resource>();\n            let v;\n            try {\n                v = await serializeProperty(`${label}.${k}`, props[k], dependentResources, opts);\n            } catch (err) {\n                // Augment the message with the property name, but rethrow the *same* error so its identity is\n                // preserved: our uncaught handler dedupes reported errors by identity, and the same rejection can\n                // surface from more than one awaiter.\n                if (err instanceof Error) {\n                    err.message = `error serializing property \"${k}\": ${err.message}`;\n                    throw err;\n                }\n                throw new Error(`error serializing property \"${k}\": ${String(err)}`);\n            }\n            if (v !== undefined) {\n                result[k] = v;\n                propertyToDependentResources.set(k, dependentResources);\n            }\n        }\n    }\n\n    return [result, propertyToDependentResources];\n}\n\n/**\n * Walks the props object passed in, awaiting all interior promises besides\n * those for `id` and `urn`, creating a reasonable POJO object that can be\n * remoted over to {@link registerResource}.\n */\nexport async function serializeResourceProperties(label: string, props: Inputs, opts?: SerializationOptions) {\n    return serializeFilteredProperties(label, props, (key) => key !== \"id\" && key !== \"urn\", opts);","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/nodejs/runtime/rpc.ts#L177-L213","documentation":"When serializing a resource's input properties to send to the engine, the SDK wraps any exception raised while serializing property `k` into an error prefixed with `error serializing property \"k\": ...`. This preserves the original error (if it's an Error instance) while telling you which property failed. The underlying cause is usually a value the serializer cannot handle, or a promise/output rejection inside the property value.","triggerScenarios":"Passing a value to a resource's props that `serializeProperty` cannot encode: unsupported types (functions, symbols, class instances without marshaling support), a Promise that rejects, an Output whose underlying value throws during serialization, or cyclic references inside an object/array property.","commonSituations":"Passing a callback or a non-serializable object (e.g. a database handle, a class instance) as a resource input; a computed Output whose value throws; deeply nested config objects containing unsupported types; cyclic data structures built from config.","solutions":["Read the wrapped inner error after the prefix to identify the offending value type, then remove or convert that value in the failing property.","Wrap non-serializable values as strings, JSON-serializable plain objects, or `pulumi.Output` of such values.","If the property is a rejected Promise/Output, fix the code that computes it so it resolves or handles its own error.","Break cyclic references before passing data as inputs."],"exampleFix":"// before\nnew Provider(\"p\", { client: dbClient }); // non-serializable class instance\n// after\nnew Provider(\"p\", { client: pulumi.output(dbClient.name) }); // serialize a plain value","handlingStrategy":"try-catch","validationCode":"function isSerializable(v) {\n  return v === null || typeof v !== 'object' || v instanceof pulumi.Output ||\n    !(typeof v === 'function' || v.constructor !== Object && !Array.isArray(v) && !(v instanceof Promise));\n}","typeGuard":"function isPlainSerializable(v: unknown): boolean {\n  return v === null || ['string','number','boolean'].includes(typeof v) ||\n    v instanceof pulumi.Output || v instanceof Promise || Array.isArray(v) ||\n    (typeof v === 'object' && Object.getPrototypeOf(v) === Object.prototype);\n}","tryCatchPattern":"try {\n  await serializeProps(props);\n} catch (err) {\n  const m = /error serializing property \"([^\"]+)\"/.exec(err.message);\n  if (m) console.error(`Fix input property '${m[1]}': ${err.message}`);\n  throw err;\n}","preventionTips":["Only pass strings, numbers, booleans, plain objects/arrays, Outputs, or Assets as inputs","Strip class instances, functions, and cyclic references before passing them as props","Ensure Promises/Outputs used as inputs cannot reject"],"tags":["nodejs","serialization","rpc"],"backgroundTag":"property-serialization-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}