{"record":{"id":"fbc04a2bea51f526","repo":"github/copilot-sdk","slug":"embedded-version-s-does-not-match-detected-versio","errorCode":null,"errorMessage":"embedded version %s does not match detected version %s - update required","messagePattern":"embedded version (.+?) does not match detected version (.+?) - update required","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":1313,"sourceCode":"\t\t}\n\t\treturn fmt.Errorf(\"failed to read existing Go file: %w\", err)\n\t}\n\n\t// Extract version from the generated file\n\t// Looking for: Version: \"x.y.z\",\n\tre := regexp.MustCompile(`Version:\\s*\"([^\"]+)\"`)\n\tmatches := re.FindSubmatch(data)\n\tif matches == nil {\n\t\t// Can't parse version, skip check\n\t\treturn nil\n\t}\n\n\tembeddedVersion := string(matches[1])\n\tfmt.Printf(\"Found existing embedded version: %s\\n\", embeddedVersion)\n\n\t// Compare versions\n\tif embeddedVersion != detectedVersion {\n\t\treturn fmt.Errorf(\"embedded version %s does not match detected version %s - update required\", embeddedVersion, detectedVersion)\n\t}\n\n\tfmt.Printf(\"Embedded version is up to date (%s)\\n\", embeddedVersion)\n\treturn nil\n}\n","sourceCodeStart":1295,"sourceCodeEnd":1319,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L1295-L1319","documentation":"checkEmbeddedVersion extracts the version recorded in the previously generated file and compares it to the CLI version detected for the current build. If they differ, it aborts with this message stating that an update is required, preventing a bundle that embeds a mismatched CLI version.","triggerScenarios":"The detected CLI version (from the downloaded/installed CLI) changed since the embedded version file was last generated — e.g. after a CLI upgrade, a branch switch that changed the embedded file, or running the bundler against a different CLI version than the code embeds.","commonSituations":"Upgrading the Copilot CLI dependency without rerunning the full bundler pipeline; merging a branch where the embedded version file was hand-edited; CI cache restoring an outdated generated file while fetching a newer CLI.","solutions":["Rerun the bundler so the embedded version file is regenerated for the newly detected version","Delete the stale generated version file so the check is skipped (no existing file means nothing to verify) and rebuild","Pin the detected CLI to the embedded version (install the matching CLI release) if you must keep the old embed","Investigate why versions diverge — check CI caching and which CLI source (local vs downloaded) feeds detectedVersion"],"exampleFix":"// before\n// bundler aborts: embedded version 1.2.3 does not match detected 1.3.0\n// after\n$ rm go/internal/embeddedcli/version_gen.go && bundler build   # regenerate embed for detected version","handlingStrategy":"validation","validationCode":"// before bundling, confirm the embedded version matches the CLI you will bundle\nversion, _ := readEmbeddedVersion(goFilePath)\nif version != detectedVersion { /* regenerate embed or pin CLI */ }","typeGuard":null,"tryCatchPattern":"// Go\nif err := checkEmbeddedVersion(detected, goos, goarch, outDir); err != nil {\n\treturn fmt.Errorf(\"regenerate embedded version file and retry: %w\", err)\n}","preventionTips":["Always rerun the full bundler pipeline after a CLI version bump","Avoid restoring stale generated files from CI caches","Pin the CLI version used for detection and embedding together"],"tags":["versioning","build","cli"],"backgroundTag":"incompatible-source-type","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}