{"record":{"id":"1e4be241913b0f6a","repo":"dagger/dagger","slug":"decode-persisted-git-repository-unsupported-form","errorCode":null,"errorMessage":"decode persisted git repository: unsupported form %q","messagePattern":"decode persisted git repository: unsupported form %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/git.go","lineNumber":573,"sourceCode":"\t\t\tURL:           parsedURL,\n\t\t\tSSHKnownHosts: persisted.Remote.SSHKnownHosts,\n\t\t\tAuthUsername:  persisted.Remote.AuthUsername,\n\t\t\tPlatform:      persisted.Remote.Platform,\n\t\t}\n\t\tvar mirror dagql.ObjectResult[*RemoteGitMirror]\n\t\tif err := dag.Select(ctx, dag.Root(), &mirror, dagql.Selector{\n\t\t\tField: \"_remoteGitMirror\",\n\t\t\tArgs: []dagql.NamedInput{\n\t\t\t\t{Name: \"remoteURL\", Value: dagql.String(parsedURL.Remote())},\n\t\t\t},\n\t\t}); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"decode persisted git repository remote mirror: %w\", err)\n\t\t}\n\t\tbackend.Mirror = mirror\n\t\trepo.Backend = backend\n\t\trepo.URL = dagql.NonNull(dagql.String(parsedURL.String()))\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"decode persisted git repository: unsupported form %q\", persisted.Form)\n\t}\n\treturn repo, nil\n}\n\ntype persistedGitRefPayload struct {\n\tRepoResultID uint64 `json:\"repoResultID\"`\n\tName         string `json:\"name,omitempty\"`\n\tSHA          string `json:\"sha\"`\n}\n\nfunc (ref *GitRef) EncodePersistedObject(ctx context.Context, cache dagql.PersistedObjectCache) (dagql.PersistedObjectEncoding, error) {\n\t_ = ctx\n\tif ref == nil {\n\t\treturn dagql.PersistedObjectEncoding{}, fmt.Errorf(\"encode persisted git ref: nil ref\")\n\t}\n\tif ref.Ref == nil {\n\t\treturn dagql.PersistedObjectEncoding{}, fmt.Errorf(\"encode persisted git ref: missing ref\")\n\t}","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/git.go#L555-L591","documentation":"DecodePersistedObject switches on persisted.Form (local or remote). Any other form value — including empty or unknown enum strings — hits the default branch and errors with 'decode persisted git repository: unsupported form %q'. It indicates the payload's form discriminator is unrecognized by this decoder version.","triggerScenarios":"Decoding a payload whose persisted.Form is empty, corrupted, or was written by a newer/older version using a form constant this decoder doesn't know.","commonSituations":"Dagger upgraded: a new persistedGitRepositoryForm constant was added in the encoder but the decoder (or vice versa) wasn't updated; cache data from a different version; payload corruption flipping the form string.","solutions":["Check the quoted form value in the error against the persistedGitRepositoryForm* constants","Re-create the repository so a fresh payload with a known form is written","Align encoder/decoder enum constants across versions; add a case for the new form","Clear stale persisted data written by an incompatible version"],"exampleFix":"// before\ndefault:\n\treturn nil, fmt.Errorf(\"decode persisted git repository: unsupported form %q\", persisted.Form)\n// after\ncase persistedGitRepositoryFormBundle:\n\t// handle new form\ndefault:\n\treturn nil, fmt.Errorf(\"decode persisted git repository: unsupported form %q\", persisted.Form)","handlingStrategy":"validation","validationCode":"var probe struct{ Form string `json:\"form\"` }\njson.Unmarshal(payload, &probe)\nswitch probe.Form {\ncase \"local\", \"remote\": // known forms\ndefault:\n\t// unknown form: payload from incompatible version; recreate\n}","typeGuard":"func knownGitRepoForm(form string) bool {\n\treturn form == \"local\" || form == \"remote\"\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unsupported form\") {\n\t// discard stale ID and recreate the GitRepository with the current SDK version\n}","preventionTips":["Bump/carry a payload version field when adding new forms","Update encoder and decoder form constants in the same commit","Clear persisted caches after upgrading across format changes"],"tags":["persistence","deserialization","versioning"],"backgroundTag":"unsupported-enum-value","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}