{"record":{"id":"46d83b4d389c95a2","repo":"hashicorp/terraform","slug":"error-checking-latest-version-s","errorCode":null,"errorMessage":"\nError checking latest version: %s","messagePattern":"\nError checking latest version: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/command/version.go","lineNumber":104,"sourceCode":"\t// since the most recent change to dependencies.\n\t//\n\t// Generally-speaking this is a best-effort thing that will give us a good\n\t// result in the usual case where the user successfully ran \"terraform init\"\n\t// and then hit a problem running _another_ command.\n\tvar providerLocks map[addrs.Provider]*depsfile.ProviderLock\n\tif locks, err := c.lockedDependencies(); err == nil {\n\t\tproviderLocks = locks.AllProviders()\n\t}\n\n\t// If we have a version check function, then let's check for\n\t// the latest version as well.\n\tvar latest string\n\tvar outdated bool\n\tif c.CheckFunc != nil {\n\t\t// Check the latest version\n\t\tinfo, err := c.CheckFunc()\n\t\tif err != nil {\n\t\t\tdiags = diags.Append(fmt.Errorf(\n\t\t\t\t\"\\nError checking latest version: %s\", err))\n\t\t}\n\t\tif info.Outdated {\n\t\t\tlatest = info.Latest\n\t\t\toutdated = true\n\t\t}\n\t}\n\n\t// Format and print output\n\tview.LogVersion(version, platform, providerLocks, outdated, latest, diags)\n\n\treturn 0\n}\n\nfunc (c *VersionCommand) Synopsis() string {\n\treturn \"Show the current Terraform version\"\n}\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/version.go#L86-L122","documentation":"Thrown by the `terraform version` command after the optional version-check function (c.CheckFunc, typically the HashiCorp Checkpoint service) returns a non-nil error. The command does NOT abort: the error is appended to diagnostics, the version banner still prints, and the command returns exit code 0. It is purely informational — the latest-version probe failed, not the version command itself.","triggerScenarios":"Invoking `terraform version` (or any path that runs VersionCommand.Run with CheckFunc set) when the checkpoint endpoint is unreachable, the response is malformed, or CheckFunc was wired to a custom function that itself returned an error.","commonSituations":"Air-gapped / offline host, corporate proxy blocking checkpoint.hashicorp.com, DNS failure, expired/clock-skewed TLS, or CHECKPOINT_DISABLE tripping a custom build that still defines CheckFunc but errors when the service is absent.","solutions":["Ignore it — the command still succeeds (exit 0); the only effect is no 'outdated' banner.","If the noise is unwanted, set CHECKPOINT_DISABLE=1 (or disable checkpoint in config) so CheckFunc short-circuits before any network call.","Restore network egress to the checkpoint service (e.g. checkpoint.hashicorp.com) and retry.","If using a custom CheckFunc, ensure it returns (nil, nil) on soft failure instead of an error."],"exampleFix":"// before\ninfo, err := c.CheckFunc()\nif err != nil {\n    diags = diags.Append(fmt.Errorf(\"\\nError checking latest version: %s\", err))\n}\n\n// after — treat checkpoint errors as soft, keep running\nif info, err := c.CheckFunc(); err == nil && info != nil && info.Outdated {\n    latest, outdated = info.Latest, true\n}","handlingStrategy":"try-catch","validationCode":"// pre-flight: only set CheckFunc when checkpoint is enabled and network is up\nif !checkpointDisabled() && hostReachable(\"checkpoint.hashicorp.com\") {\n    c.CheckFunc = buildCheckFunc()\n}","typeGuard":null,"tryCatchPattern":"info, err := c.CheckFunc()\nif err != nil {\n    // log at debug, do not surface to user-facing diags\n    log.Printf(\"[DEBUG] version check skipped: %v\", err)\n} else if info != nil && info.Outdated {\n    latest, outdated = info.Latest, true\n}","preventionTips":["Set CHECKPOINT_DISABLE=1 in CI/air-gapped environments to avoid noise.","Treat CheckFunc as best-effort; never let its failure fail the version command.","Document that this diagnostic is informational, not actionable."],"tags":["version-check","checkpoint","network","non-fatal"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}