{"record":{"id":"b0ddce291cc91c1a","repo":"kubernetes/kops","slug":"error-querying-droplet-metadata-w","errorCode":null,"errorMessage":"error querying droplet metadata: %w","messagePattern":"error querying droplet metadata: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/do/dometadata/authenticator.go","lineNumber":61,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to fetch droplet id: %w\", err)\n\t}\n\treturn DOAuthenticationTokenPrefix + dropletID, nil\n}\n\nconst (\n\tdropletIDMetadataURL = \"http://169.254.169.254/metadata/v1/id\"\n)\n\n// GetDropletID returns the droplet ID from the metadata service.\nfunc GetDropletID() (string, error) {\n\treturn getMetadata(dropletIDMetadataURL)\n}\n\nfunc getMetadata(url string) (string, error) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error querying droplet metadata: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"droplet metadata returned non-200 status code: %d\", resp.StatusCode)\n\t}\n\n\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error reading droplet metadata: %w\", err)\n\t}\n\n\treturn string(bodyBytes), nil\n}\n","sourceCodeStart":43,"sourceCodeEnd":76,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/do/dometadata/authenticator.go#L43-L76","documentation":"getMetadata wraps http.Get failure when querying the DigitalOcean droplet metadata endpoint (http://169.254.169.254/metadata/v1/id). It fires when the metadata service is unreachable from the droplet — not running on DO, networking/firewall blocking link-local, or transient network failure — so the bootstrap authenticator cannot build the droplet-scoped token.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/do/dometadata/authenticator.go:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check node networking/firewall access to 169.254.169.254","Confirm the instance is a DigitalOcean droplet","Retry bootstrap once the network path is healthy"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}