github/copilot-sdk · error
embedded version does not match detected version - update…
Error message
embedded version %s does not match detected version %s - update required
What it means
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.
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
Example fix
// before // bundler aborts: embedded version 1.2.3 does not match detected 1.3.0 // after $ rm go/internal/embeddedcli/version_gen.go && bundler build # regenerate embed for detected version
Defensive patterns
Strategy: validation
Validate before calling
// before bundling, confirm the embedded version matches the CLI you will bundle
version, _ := readEmbeddedVersion(goFilePath)
if version != detectedVersion { /* regenerate embed or pin CLI */ } Try / catch
// Go
if err := checkEmbeddedVersion(detected, goos, goarch, outDir); err != nil {
return fmt.Errorf("regenerate embedded version file and retry: %w", err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- Missing version resource: — ensure Maven resource…
- Blank or missing 'version' property in — check Maven…
- failed to get SDK version
- failed to fetch CLI version
- joinSession() is intended for extensions running as child…
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/fbc04a2bea51f526.
Report an issue: GitHub.
Appendix: source
Thrown at go/cmd/bundler/main.go:1313
}
return fmt.Errorf("failed to read existing Go file: %w", err)
}
// Extract version from the generated file
// Looking for: Version: "x.y.z",
re := regexp.MustCompile(`Version:\s*"([^"]+)"`)
matches := re.FindSubmatch(data)
if matches == nil {
// Can't parse version, skip check
return nil
}
embeddedVersion := string(matches[1])
fmt.Printf("Found existing embedded version: %s\n", embeddedVersion)
// Compare versions
if embeddedVersion != detectedVersion {
return fmt.Errorf("embedded version %s does not match detected version %s - update required", embeddedVersion, detectedVersion)
}
fmt.Printf("Embedded version is up to date (%s)\n", embeddedVersion)
return nil
}
View on GitHub (pinned to cd8cf15dc3)