{"record":{"id":"89718087ae435c36","repo":"containerd/containerd","slug":"unable-to-downgrade-because-shim-version-d-is-l","errorCode":null,"errorMessage":"unable to downgrade because shim version (%d) is lower than CurrentShimVersion (%d)","messagePattern":"unable to downgrade because shim version \\((.+?)\\) is lower than CurrentShimVersion \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/runtime/v2/shim.go","lineNumber":516,"sourceCode":"func (s *shim) BootstrapResult() *bootapi.BootstrapResult {\n\treturn s.bootstrap\n}\n\n// ID of the shim/task\nfunc (s *shim) ID() string {\n\treturn s.bundle.ID\n}\n\nfunc (s *shim) Endpoint() (string, int) {\n\treturn s.address, s.version\n}\n\nfunc (s *shim) Downgrade() error {\n\tif s.version >= CurrentShimVersion {\n\t\ts.version--\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unable to downgrade because shim version (%d) is lower than CurrentShimVersion (%d)\",\n\t\ts.version, CurrentShimVersion)\n}\n\nfunc (s *shim) Namespace() string {\n\treturn s.bundle.Namespace\n}\n\nfunc (s *shim) Bundle() string {\n\treturn s.bundle.Path\n}\n\nfunc (s *shim) Client() any {\n\treturn s.client\n}\n\n// Close closes the underlying client connection.\nfunc (s *shim) Close() error {\n\tif ttrpcClient, ok := s.client.(*ttrpc.Client); ok {","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/containerd/containerd/blob/4246446a2bf7d03837b0244118d858799393bd80/core/runtime/v2/shim.go#L498-L534","documentation":"shim.Downgrade steps a shim's tracked version down (used in version-negotiation fall-back logic). It refuses when s.version is already below CurrentShimVersion (or at the floor), because decrementing further would represent a protocol version this containerd cannot reason about, so it returns this descriptive error.","triggerScenarios":"Calling Downgrade on a shim whose s.version < CurrentShimVersion (e.g. version already at 0, 1, or 2 while CurrentShimVersion is 3).","commonSituations":"Repeated Downgrade calls exhausting the version; a shim that reported an older protocol version during handshake then being asked to downgrade again.","solutions":["Do not call Downgrade once the shim's version is below CurrentShimVersion; check s.version first","Treat the shim as operating at its advertised version and handle the older protocol, or restart with a compatible shim","If the goal is negotiating down from a newer shim, ensure the initial version actually exceeded CurrentShimVersion before downgrading"],"exampleFix":"// before\nif err := shim.Downgrade(); err != nil { return err }\n// after\nif shim.Version() >= CurrentShimVersion {\n    if err := shim.Downgrade(); err != nil { return err }\n}","handlingStrategy":"validation","validationCode":"if shim.Version() >= CurrentShimVersion {\n    if err := shim.Downgrade(); err != nil { /* ... */ }\n}","typeGuard":null,"tryCatchPattern":"if err := shim.Downgrade(); err != nil {\n    log.G(ctx).WithError(err).Debug(\"shim already at minimum protocol version; skipping downgrade\")\n}","preventionTips":["Track the shim version returned at handshake and guard downgrade logic with it","Limit downgrade attempts to at most (version - minSupported) calls","Treat Downgrade failure as informational in negotiation fallback paths"],"tags":["containerd","shim","versioning"],"backgroundTag":"shim-version-mismatch","analyzedSha":"4246446a2bf7d03837b0244118d858799393bd80","analyzedAt":"2026-09-02T00:14:43.053Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}