{"record":{"id":"fea09598dda827da","repo":"github/copilot-sdk","slug":"invalid-platform-q","errorCode":null,"errorMessage":"invalid platform %q","messagePattern":"invalid platform %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":167,"sourceCode":"\t\tmuslBundle.assetsArtifactPath,\n\t\tmuslBundle.assetsHash,\n\t\tpkgName,\n\t); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tif err := ensureZstdDependency(); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n}\n\n// resolvePlatform validates the platform flag and returns GOOS/GOARCH and mapping info.\nfunc resolvePlatform(platform string) (string, string, platformInfo, error) {\n\tgoos, goarch, ok := strings.Cut(platform, \"/\")\n\tif !ok || goos == \"\" || goarch == \"\" {\n\t\treturn \"\", \"\", platformInfo{}, fmt.Errorf(\"invalid platform %q\", platform)\n\t}\n\tinfo, ok := platforms[platform]\n\tif !ok {\n\t\treturn \"\", \"\", platformInfo{}, fmt.Errorf(\"invalid platform %q\", platform)\n\t}\n\treturn goos, goarch, info, nil\n}\n\n// resolveCLIVersion determines the CLI version from the flag or repo metadata.\nfunc resolveCLIVersion(flagValue string) string {\n\tif flagValue != \"\" {\n\t\treturn flagValue\n\t}\n\tversion, err := detectCLIVersion()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error detecting CLI version: %v\\n\", err)\n\t\tfmt.Fprintln(os.Stderr, \"Hint: specify --cli-version explicitly, or run from a Go module that depends on github.com/github/copilot-sdk/go\")\n\t\tos.Exit(1)","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L149-L185","documentation":"resolvePlatform validates the bundler's --platform flag, which must be in GOOS/GOARCH form (e.g. linux/amd64). This instance fires when the value cannot be split on '/' into a non-empty GOOS and GOARCH. Both invalid-format and unknown-platform cases return the same message.","triggerScenarios":"Running the bundler with a --platform value lacking a '/' separator, or with empty GOOS or GOARCH parts (e.g. --platform linux, --platform /amd64, --platform linux/).","commonSituations":"Typos like 'linux amd64' (space instead of slash); passing only the OS name; copying a Docker-style platform tag such as 'linux' alone; shell mangling 'linux/amd64' (unquoted in some contexts is fine, but quoting mistakes drop part of the value).","solutions":["Use the full GOOS/GOARCH form, e.g. --platform linux/amd64 or --platform darwin/arm64.","Quote the flag value in the shell to prevent splitting: --platform \"linux/amd64\".","Check the platforms map in go/cmd/bundler/main.go for the list of supported platform strings.","Print the parsed value (echo of args) to confirm the flag actually received both parts."],"exampleFix":"// before\nbundler --platform linux\n\n// after\nbundler --platform linux/amd64","handlingStrategy":"validation","validationCode":"func validPlatformFormat(p string) bool {\n    goos, goarch, ok := strings.Cut(p, \"/\")\n    return ok && goos != \"\" && goarch != \"\"\n}","typeGuard":null,"tryCatchPattern":"goos, goarch, info, err := resolvePlatform(*platformFlag)\nif err != nil {\n    log.Fatalf(\"--platform must be GOOS/GOARCH (e.g. linux/amd64): %v\", err)\n}","preventionTips":["Always pass GOOS/GOARCH with a slash; quote the flag in shell scripts.","Shell-complete or hardcode platform values in CI pipelines.","Document accepted values next to the flag usage."],"tags":["cli","flag","platform","validation","go"],"backgroundTag":"invalid-argument-format","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}