{"record":{"id":"7bba9d77b9b4b348","repo":"kopia/kopia","slug":"error-writing-dir-manifest","errorCode":null,"errorMessage":"error writing dir manifest","messagePattern":"error writing dir manifest","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"snapshot/upload/upload.go","lineNumber":1192,"sourceCode":"\tchildCheckpointRegistry := &checkpointRegistry{}\n\n\tmetadataComp := policyTree.EffectivePolicy().MetadataCompressionPolicy.MetadataCompressor()\n\n\tthisCheckpointRegistry.addCheckpointCallback(directory.Name(), func() (*snapshot.DirEntry, error) {\n\t\t// when snapshotting the parent, snapshot all our children and tell them to populate\n\t\t// childCheckpointBuilder\n\t\tthisCheckpointBuilder := thisDirBuilder.Clone()\n\n\t\t// invoke all child checkpoints which will populate thisCheckpointBuilder.\n\t\tif err := childCheckpointRegistry.runCheckpoints(thisCheckpointBuilder); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"error checkpointing children\")\n\t\t}\n\n\t\tcheckpointManifest := thisCheckpointBuilder.Build(fs.UTCTimestampFromTime(directory.ModTime()), IncompleteReasonCheckpoint)\n\n\t\toid, err := snapshotfs.WriteDirManifest(ctx, u.repo, dirRelativePath, checkpointManifest, metadataComp)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"error writing dir manifest\")\n\t\t}\n\n\t\treturn newDirEntryWithSummary(directory, oid, checkpointManifest.Summary)\n\t})\n\tdefer thisCheckpointRegistry.removeCheckpointCallback(directory.Name())\n\n\tif err := u.processChildren(ctx, childCheckpointRegistry, thisDirBuilder, localDirPathOrEmpty, dirRelativePath, directory, policyTree, uniqueDirectories(previousDirs)); err != nil && !errors.Is(err, errCanceled) {\n\t\treturn nil, err\n\t}\n\n\tdirManifest := thisDirBuilder.Build(fs.UTCTimestampFromTime(directory.ModTime()), u.incompleteReason())\n\n\toid, err := snapshotfs.WriteDirManifest(ctx, u.repo, dirRelativePath, dirManifest, metadataComp)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error writing dir manifest: %v\", directory.Name())\n\t}\n\n\treturn newDirEntryWithSummary(directory, oid, dirManifest.Summary)","sourceCodeStart":1174,"sourceCodeEnd":1210,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/snapshot/upload/upload.go#L1174-L1210","documentation":"During a checkpointed directory upload, the intermediate checkpoint manifest is persisted with snapshotfs.WriteDirManifest, which writes the directory manifest object to the repository. Failure to write that manifest (storage error, metadata serialization failure) aborts with this error.","triggerScenarios":"Thrown at snapshot/upload/upload.go:1192 when the library encounters an invalid state.","commonSituations":"Storage backend outages or quota exhaustion during long uploads; repository object-write failures; encryption/format errors on metadata objects.","solutions":["Check the wrapped cause: verify repository storage is reachable and writable","Retry the snapshot once storage is healthy","Run kopia repository status / verify storage-backend health","Disable checkpointing if the checkpoint write path is repeatedly failing"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if _, err := repo.VerifyObject(ctx, oid); err != nil {\n    return fmt.Errorf(\"repository not writable/healthy: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"de, err := uploadDirInternal(...)\nif err != nil && strings.Contains(err.Error(), \"error writing dir manifest\") {\n    if isTransient(err) {\n        return retryWithBackoff(func() error { _, err = uploadDirInternal(...); return err })\n    }\n    return err\n}","preventionTips":["Monitor storage backend availability and quotas","Configure retries at the storage-client layer","Verify repository health with kopia repository status before long snapshots","Avoid running snapshots during storage maintenance windows"],"tags":["go","snapshot","checkpoint","repository-write"],"backgroundTag":"file-write-failed","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}