{"record":{"id":"db1bb67078af0f63","repo":"pulumi/pulumi","slug":"transform-failed-e","errorCode":null,"errorMessage":"transform failed: ${e}","messagePattern":"transform failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdk/nodejs/runtime/callbacks.ts","lineNumber":440,"sourceCode":"                            for (const prov of provs) {\n                                const providerURN = await prov.urn.promise();\n                                const providerID = (await prov.id.promise()) || unknownValue;\n                                providers.set(prov.getPackage(), `${providerURN}::${providerID}`);\n                            }\n                            opts.clearProvidersMap();\n                        }\n                    }\n                }\n                response.setOptions(opts);\n            }\n\n            return response;\n        };\n        const tryCb = async (bytes: Uint8Array): Promise<jspb.Message> => {\n            try {\n                return await cb(bytes);\n            } catch (e) {\n                throw new Error(`transform failed: ${e}`);\n            }\n        };\n        const uuid = randomUUID();\n        this._callbacks.set(uuid, tryCb);\n        const monitor = this._monitor as any;\n        if (typeof monitor.recordTransformCallback === \"function\") {\n            monitor.recordTransformCallback(uuid, transform);\n        }\n        const req = new Callback();\n        req.setToken(uuid);\n        req.setTarget(await this._target);\n        return req;\n    }\n\n    registerStackTransform(transform: ResourceTransform): void {\n        this._pendingRegistrations++;\n\n        this.registerTransform(transform)","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/nodejs/runtime/callbacks.ts#L422-L458","documentation":"The callbacks runtime wraps resource-transform gRPC callbacks in tryCb, which re-throws any callback exception as 'transform failed: <cause>'. This wrapping gives the engine a consistent error for a failing transform so the deployment can be aborted with context.","triggerScenarios":"A transform callback registered via recordTransformCallback (transform applied to resource options) throws — e.g. user transform code raising an exception, or an error deserializing the transform request message.","commonSituations":"Bugs in user-supplied transform functions; transforms referencing options that don't exist on the incoming resource; protobuf decode failures from protocol mismatch.","solutions":["Inspect the wrapped cause after 'transform failed:' in the message and fix the exception in the transform callback","Log inside your transform function to find which resource/option triggers it","Align SDK and engine versions if the failure is a deserialization error"],"exampleFix":"// before\npulumi.runtime.transform({ resources: [\"aws:s3/bucket:Bucket\"], callback: async (args) => { throw new Error(\"oops\"); } });\n// after\npulumi.runtime.transform({ resources: [\"aws:s3/bucket:Bucket\"], callback: async (args) => { return args; } });","handlingStrategy":"try-catch","validationCode":"if (typeof callback !== \"function\") throw new Error(\"transform callback must be a function\");","typeGuard":null,"tryCatchPattern":"try { await monitor.recordTransformCallback(uuid, tryCb); } catch (e) { console.error(\"transform failed:\", e); throw e; }","preventionTips":["Test transform callbacks before deploying","Handle all expected option shapes inside the callback","Keep engine and SDK versions aligned to avoid decode errors"],"tags":["nodejs","grpc","transforms","callbacks"],"backgroundTag":"transform-callback-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}