{"record":{"id":"4876485229c6e1a0","repo":"kubernetes/kops","slug":"invalid-google-cloud-url-token-count-q","errorCode":null,"errorMessage":"invalid google cloud URL (token count): %q","messagePattern":"invalid google cloud URL \\(token count\\): %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gce/gce_url.go","lineNumber":59,"sourceCode":"\t\turl += \"projects/\" + u.Project + \"/\"\n\t}\n\tif u.Global {\n\t\turl += \"global/\"\n\t}\n\tif u.Region != \"\" {\n\t\turl += \"regions/\" + u.Region + \"/\"\n\t}\n\tif u.Zone != \"\" {\n\t\turl += \"zones/\" + u.Zone + \"/\"\n\t}\n\turl += u.Type + \"/\" + u.Name\n\treturn url\n}\n\nfunc ParseGoogleCloudURL(u string) (*GoogleCloudURL, error) {\n\ttokens := strings.Split(u, \"/\")\n\tif len(tokens) < 3 {\n\t\treturn nil, fmt.Errorf(\"invalid google cloud URL (token count): %q\", u)\n\t}\n\n\tif tokens[0] != \"https:\" || tokens[1] != \"\" || tokens[2] != \"www.googleapis.com\" {\n\t\treturn nil, fmt.Errorf(\"invalid google cloud URL (schema / host): %q\", u)\n\t}\n\n\tif len(tokens) < 5 || tokens[3] != \"compute\" {\n\t\treturn nil, fmt.Errorf(\"invalid google cloud URL (not compute): %q\", u)\n\t}\n\n\tif tokens[4] != \"v1\" && tokens[4] != \"beta\" {\n\t\treturn nil, fmt.Errorf(\"invalid google cloud URL (not compute/v1 or compute/beta): %q\", u)\n\t}\n\n\tparsed := &GoogleCloudURL{\n\t\tVersion: tokens[4],\n\t}\n\tpos := 5","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gce/gce_url.go#L41-L77","documentation":"First-stage parse guard in ParseGoogleCloudURL: splitting the URL on '/' yields fewer than three tokens, so it cannot even contain scheme+host. Fires on drastically malformed self-link strings (empty, relative paths, garbage).","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gce/gce_url.go:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a full GCE self-link URL (https://www.googleapis.com/...)","Check where the malformed value came from (resource config vs API response)","Fix the source of the URL and re-run"],"exampleFix":null,"handlingStrategy":"validation","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"}