{"record":{"id":"685e54ca8522f64d","repo":"kubernetes/kops","slug":"error-getting-instance-from-metadata-w","errorCode":null,"errorMessage":"error getting instance from metadata: %w","messagePattern":"error getting instance from metadata: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gce/tpm/gcetpmsigner/tpmauthenticator.go","lineNumber":56,"sourceCode":"\tprojectID string\n\tzone      string\n\tinstance  string\n}\n\nvar _ bootstrap.Authenticator = (*tpmAuthenticator)(nil)\n\nfunc NewTPMAuthenticator() (bootstrap.Authenticator, error) {\n\tprojectID, err := metadata.ProjectID()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting projectID from metadata: %w\", err)\n\t}\n\tzone, err := metadata.Zone()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting zone from metadata: %w\", err)\n\t}\n\tinstance, err := metadata.InstanceName()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting instance from metadata: %w\", err)\n\t}\n\n\treturn &tpmAuthenticator{\n\t\tprojectID: projectID,\n\t\tzone:      zone,\n\t\tinstance:  instance,\n\t}, nil\n}\n\nfunc (a *tpmAuthenticator) CreateToken(body []byte) (string, error) {\n\trequestHash := sha256.Sum256(body)\n\n\ttpmStart := time.Now()\n\n\ttpmDevice, err := openTPM()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to open TPM: %w\", err)\n\t}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gce/tpm/gcetpmsigner/tpmauthenticator.go#L38-L74","documentation":"Same initializer: metadata.InstanceName failure while fetching the instance name from the GCE metadata server. Along with projectID and zone, the instance name is required to build the tpmAuthenticator; any of the three failing means node bootstrap authentication cannot proceed.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gce/tpm/gcetpmsigner/tpmauthenticator.go:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run on a GCE instance with metadata access","Check metadata server reachability","Inspect the wrapped error"],"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"}