{"record":{"id":"aef34d8eb95469fa","repo":"pulumi/pulumi","slug":"marshaling-state-migration-request-w","errorCode":null,"errorMessage":"marshaling state migration request: %w","messagePattern":"marshaling state migration request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resource/deploy/source_eval.go","lineNumber":1673,"sourceCode":"\n// Wrap the state migration callback so the engine can call the callback server, which will then execute the\n// function.  The wrapper takes care of all the necessary marshalling and unmarshalling.\nfunc (rm *resmon) wrapStateMigrationCallback(cb *pulumirpc.Callback) (StateMigrationFunction, error) {\n\tclient, err := rm.GetCallbacksClient(cb.Target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttoken := cb.Token\n\treturn func(ctx context.Context, urn resource.URN, oldState []byte) ([]byte, map[resource.URN]resource.URN, error) {\n\t\tlogging.V(5).Infof(\"StateMigration: urn=%v\", urn)\n\n\t\trequest, err := proto.Marshal(&pulumirpc.StateMigrationRequest{\n\t\t\tUrn:      string(urn),\n\t\t\tOldState: oldState,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"marshaling state migration request: %w\", err)\n\t\t}\n\n\t\tresp, err := client.Invoke(ctx, &pulumirpc.CallbackInvokeRequest{\n\t\t\tToken:   token,\n\t\t\tRequest: request,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogging.V(5).Infof(\"state migration callback error: %v\", err)\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tvar response pulumirpc.StateMigrationResponse\n\t\tif err := proto.Unmarshal(resp.Response, &response); err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"unmarshaling state migration response: %w\", err)\n\t\t}\n\n\t\tsuccessors := make(map[resource.URN]resource.URN, len(response.Successors))\n\t\tfor oldURN, newURN := range response.Successors {","sourceCodeStart":1655,"sourceCodeEnd":1691,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/resource/deploy/source_eval.go#L1655-L1691","documentation":"The engine failed to proto.Marshal a pulumirpc.StateMigrationRequest (URN + old state bytes) before invoking the state-migration callback. This request carries a provider's legacy state for migration; an encoding failure here aborts the migration path.","triggerScenarios":"A resource whose provider signals a state migration (legacy pre-2.0 style state) triggers the migration callback path and proto.Marshal of the request fails at source_eval.go:1673, typically due to nil oldState or a message exceeding proto size limits.","commonSituations":"Migrating very old stacks where OldState was populated with nil/oversized payloads; version skew in patched engine builds; extremely large legacy state blobs.","solutions":["Upgrade the Pulumi CLI to the latest version (engine-level encoding bug).","Check the oldState payload size; very large legacy state may need manual stack export/import migration instead.","If you develop the provider, ensure OldState is populated with valid bytes before requesting migration.","File a Pulumi issue with the URN and error."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Guard before requesting migration\nif len(oldState) == 0 || len(oldState) > 32*1024*1024 {\n\treturn nil, nil, fmt.Errorf(\"oldState invalid or too large (%d bytes): migrate via stack export/import\", len(oldState))\n}","typeGuard":null,"tryCatchPattern":"request, err := proto.Marshal(&pulumirpc.StateMigrationRequest{...})\nif err != nil {\n\t// fall back: surface URN so operator can migrate manually\n\treturn nil, nil, fmt.Errorf(\"state migration unavailable for %s: %w\", urn, err)\n}","preventionTips":["Upgrade to the latest CLI before refreshing very old stacks","Keep legacy state blobs within proto size limits","Prefer stack export/import for manual migrations"],"tags":["go","pulumi-engine","state-migration","protobuf"],"backgroundTag":"proto-marshal-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}