{"record":{"id":"56edf77890a8157b","repo":"hasura/graphql-engine","slug":"decoding-update-check-response-w","errorCode":null,"errorMessage":"decoding update check response: %w","messagePattern":"decoding update check response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/update/update.go","lineNumber":41,"sourceCode":"\tLatest     *semver.Version `json:\"latest\"`\n\tPreRelease *semver.Version `json:\"prerelease\"`\n}\n\nfunc getLatestVersion() (*semver.Version, *semver.Version, error) {\n\tvar op errors.Op = \"update.getLatestVersion\"\n\n\tres, err := http.Get(updateCheckURL)\n\tif err != nil {\n\t\treturn nil, nil, errors.E(op, fmt.Errorf(\"update check request: %w\", err))\n\t}\n\n\tdefer res.Body.Close()\n\n\tvar response updateCheckResponse\n\n\terr = json.NewDecoder(res.Body).Decode(&response)\n\tif err != nil {\n\t\treturn nil, nil, errors.E(op, fmt.Errorf(\"decoding update check response: %w\", err))\n\t}\n\n\tif response.Latest == nil && response.PreRelease == nil {\n\t\treturn nil, nil, errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\"expected version info not found at %s\", updateCheckURL),\n\t\t)\n\t}\n\n\treturn response.Latest, response.PreRelease, nil\n}\n\nfunc buildAssetURL(v string) string {\n\tos := runtime.GOOS\n\tarch := runtime.GOARCH\n\n\textension := \"\"\n\tif os == \"windows\" {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/update/update.go#L23-L59","documentation":"After a successful HTTP response, getLatestVersion decodes the JSON body into updateCheckResponse. This error means the body was not valid JSON for that shape: truncated output, an HTML error page from a proxy, or a changed response schema.","triggerScenarios":"Calling update.HasUpdate() when the update endpoint returns non-JSON (a captive portal or 403/502 HTML page served by a proxy) or when the response schema changed in a newer server version.","commonSituations":"Corporate proxies injecting HTML interstitials, CDN/WAF returning error pages, partial responses due to connection resets, or the update service changing its payload format.","solutions":["curl the updateCheckURL from the same environment and inspect the raw body","If a proxy/WAF is mangling the response, whitelist the update domain or disable update checks","Treat update-check failures as non-fatal: log and continue with the current version"],"exampleFix":"// before\nif _, _, err := update.HasUpdate(); err != nil { return err }\n\n// after\nif _, _, err := update.HasUpdate(); err != nil {\n    log.Printf(\"update check failed (continuing): %v\", err)\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, _, err := update.HasUpdate(); err != nil {\n    if strings.Contains(err.Error(), \"decoding update check response\") {\n        // endpoint served unexpected content; skip update flow\n    }\n}","preventionTips":["Cache the last known-good update info locally","Alert on schema changes if you operate the update endpoint"],"tags":["network","json","update-check","hasura-cli"],"backgroundTag":"json-decode-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}