kopia/kopia · error
running in write session
Error message
running in write session
What it means
Wrapper around repo.WriteSession failing while executing a CLI action inside a repository write session; the wrapped error carries the actual failure, which may be the action itself or the final flush.
Solutions
- Inspect the wrapped error for the root cause.
- Verify the repository is writable and the connection healthy, then retry the command.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at cli/app.go:479 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07).
Data as JSON: /api/errors/357311f7d95646cd.
Report an issue: GitHub.
Appendix: source
Thrown at cli/app.go:479
return repo.WriteSession(ctx, rep, repo.WriteSessionOptions{
Purpose: "cli:" + c.currentActionName(),
OnUpload: c.progress.UploadedBytes,
}, act)
})
}
// repositoryWriterActionWithMaintenance runs act in a write session and
// may run opportunistic automatic maintenance on success. It should be used
// only for operations that modify snapshot data such as snapshot create/delete.
func (c *App) repositoryWriterActionWithMaintenance(act func(ctx context.Context, rw repo.RepositoryWriter) error) func(ctx *kingpin.ParseContext) error {
return c.repositoryAction(func(ctx context.Context, rep repo.Repository) error {
o := repo.WriteSessionOptions{
Purpose: "cli:" + c.currentActionName(),
OnUpload: c.progress.UploadedBytes,
}
if err := repo.WriteSession(ctx, rep, o, act); err != nil {
return errors.Wrap(err, "running in write session")
}
if err := c.maybeRunMaintenance(ctx, rep); err != nil {
return errors.Wrap(err, "running auto-maintenance")
}
return nil
})
}
func (c *App) runAppWithContext(command *kingpin.CmdClause, cb func(ctx context.Context) error) error {
ctx := c.rootctx
if c.loggerFactory != nil {
ctx = logging.WithLogger(ctx, c.loggerFactory)
}
for _, r := range c.trackReleasable {View on GitHub (pinned to 82495e54b5)