pulumi/pulumi · error · Error

transform failed: ${e}

Error message

transform failed: ${e}

What it means

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.

Source

Thrown at sdk/nodejs/runtime/callbacks.ts:440

                            for (const prov of provs) {
                                const providerURN = await prov.urn.promise();
                                const providerID = (await prov.id.promise()) || unknownValue;
                                providers.set(prov.getPackage(), `${providerURN}::${providerID}`);
                            }
                            opts.clearProvidersMap();
                        }
                    }
                }
                response.setOptions(opts);
            }

            return response;
        };
        const tryCb = async (bytes: Uint8Array): Promise<jspb.Message> => {
            try {
                return await cb(bytes);
            } catch (e) {
                throw new Error(`transform failed: ${e}`);
            }
        };
        const uuid = randomUUID();
        this._callbacks.set(uuid, tryCb);
        const monitor = this._monitor as any;
        if (typeof monitor.recordTransformCallback === "function") {
            monitor.recordTransformCallback(uuid, transform);
        }
        const req = new Callback();
        req.setToken(uuid);
        req.setTarget(await this._target);
        return req;
    }

    registerStackTransform(transform: ResourceTransform): void {
        this._pendingRegistrations++;

        this.registerTransform(transform)

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Inspect the wrapped cause after 'transform failed:' in the message and fix the exception in the transform callback
  2. Log inside your transform function to find which resource/option triggers it
  3. Align SDK and engine versions if the failure is a deserialization error

Example fix

// before
pulumi.runtime.transform({ resources: ["aws:s3/bucket:Bucket"], callback: async (args) => { throw new Error("oops"); } });
// after
pulumi.runtime.transform({ resources: ["aws:s3/bucket:Bucket"], callback: async (args) => { return args; } });
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof callback !== "function") throw new Error("transform callback must be a function");

Try / catch

try { await monitor.recordTransformCallback(uuid, tryCb); } catch (e) { console.error("transform failed:", e); throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: Bugs in user-supplied transform functions; transforms referencing options that don't exist on the incoming resource; protobuf decode failures from protocol mismatch.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/db1bb67078af0f63. Report an issue: GitHub.