{"record":{"id":"feeddbb9cc27cae8","repo":"hashicorp/terraform","slug":"invalid-remote-plan-format-must-be-1","errorCode":null,"errorMessage":"invalid remote plan format, must be 1","messagePattern":"invalid remote plan format, must be 1","errorType":"validation","errorClass":"ErrInvalidRemotePlanFormat","httpStatus":null,"severity":"error","filePath":"internal/cloud/cloudplan/saved_plan.go","lineNumber":13,"sourceCode":"// Copyright IBM Corp. 2014, 2026\n// SPDX-License-Identifier: BUSL-1.1\npackage cloudplan\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"io\"\n\t\"os\"\n\t\"strings\"\n)\n\nvar ErrInvalidRemotePlanFormat = errors.New(\"invalid remote plan format, must be 1\")\nvar ErrInvalidRunID = errors.New(\"invalid run ID\")\nvar ErrInvalidHostname = errors.New(\"invalid hostname\")\n\ntype SavedPlanBookmark struct {\n\tRemotePlanFormat int    `json:\"remote_plan_format\"`\n\tRunID            string `json:\"run_id\"`\n\tHostname         string `json:\"hostname\"`\n}\n\nfunc NewSavedPlanBookmark(runID, hostname string) SavedPlanBookmark {\n\treturn SavedPlanBookmark{\n\t\tRemotePlanFormat: 1,\n\t\tRunID:            runID,\n\t\tHostname:         hostname,\n\t}\n}\n\nfunc LoadSavedPlanBookmark(filepath string) (SavedPlanBookmark, error) {","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/cloudplan/saved_plan.go#L1-L31","documentation":"ErrInvalidRemotePlanFormat is returned by LoadSavedPlanBookmark() when reading a saved-plan bookmark JSON file whose 'remote_plan_format' field is not 1. NewSavedPlanBookmark always writes 1; any other value (0, missing, or a future version) is treated as an incompatible/unknown bookmark format.","triggerScenarios":"Running 'terraform show' or apply on a plan file path that is actually a cloud/remote saved-plan bookmark whose JSON 'remote_plan_format' is missing or != 1 — e.g. a hand-edited or future-format bookmark, or a non-bookmark JSON file mistaken for one.","commonSituations":"Pointing terraform at a stale bookmark from a newer terraform version; passing an arbitrary JSON file as a plan; bookmark file corrupted/truncated so the field defaults to 0.","solutions":["Regenerate the plan file with the current terraform version: re-run 'terraform plan -out=<plan>'.","Ensure you are not passing a non-plan JSON file where a plan bookmark is expected.","Use a matching terraform version to consume a bookmark produced elsewhere."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before loading a saved-plan bookmark, sanity-check the format version:\ndata, err := os.ReadFile(path)\nif err != nil { return err }\nvar probe struct{ RemotePlanFormat int `json:\"remote_plan_format\"` }\nif json.Unmarshal(data, &probe) == nil && probe.RemotePlanFormat != 1 {\n    return fmt.Errorf(\"unsupported bookmark format %d, regenerate with this terraform\", probe.RemotePlanFormat)\n}","typeGuard":null,"tryCatchPattern":"bm, err := cloudplan.LoadSavedPlanBookmark(path)\nif err != nil {\n    if errors.Is(err, cloudplan.ErrInvalidRemotePlanFormat) {\n        // ask user to regenerate the plan with the current terraform version\n        return err\n    }\n    return err\n}","preventionTips":["Regenerate plan files with the same terraform version that will apply them.","Do not hand-edit or reuse plan/bookmark files across versions.","Check errors.Is(err, ErrInvalidRemotePlanFormat) and prompt to re-plan."],"tags":["terraform","cloud-backend","plan","bookmark","version-compat"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}