{"record":{"id":"ccbaf68fca7f14ea","repo":"multica-ai/multica","slug":"create-hermes-memory-store-parent-s-w","errorCode":null,"errorMessage":"create hermes memory store parent %s: %w","messagePattern":"create hermes memory store parent (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/execenv/hermes_memory.go","lineNumber":264,"sourceCode":"\t\tlogger.Info(\"execenv: another task populated the hermes memory store first; keeping it\", \"store\", storeDir)\n\t\treturn nil\n\t}\n\tlogger.Info(\"execenv: migrated task-local hermes memories into agent store\", \"store\", storeDir, \"entries\", len(entries))\n\treturn nil\n}\n\n// newHermesStoreStaging creates the scratch directory a store migration copies\n// into. It is a sibling of the store so the promoting rename stays within one\n// filesystem, and dot-prefixed so it is obvious it is not a store of its own.\n// Shared by the memory migration here and the session-database migration in\n// hermes_sessions.go: both delete their source once the copy reports success,\n// so both need the same all-or-nothing publish.\n// MkdirTemp already creates it 0700, the same mode the store itself is created\n// with, so there is no follow-up chmod that could fail and strand it.\nfunc newHermesStoreStaging(storeDir string) (string, error) {\n\tparent := filepath.Dir(storeDir)\n\tif err := os.MkdirAll(parent, 0o700); err != nil {\n\t\treturn \"\", fmt.Errorf(\"create hermes memory store parent %s: %w\", parent, err)\n\t}\n\tstaging, err := os.MkdirTemp(parent, \".\"+filepath.Base(storeDir)+\".migrating-\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"create hermes memory staging dir in %s: %w\", parent, err)\n\t}\n\treturn staging, nil\n}\n\n// promoteHermesStoreStaging publishes a fully-copied staging dir as the store,\n// reporting whether this caller won. The empty store dir (if any) is removed\n// first: os.Remove only succeeds on an empty directory, so a store another task\n// already populated makes this a no-op, and Windows rejects a rename onto an\n// existing directory outright.\n//\n// Losing the race is not an error — the winner's store holds the same agent's\n// state — but it has to be positively confirmed, never inferred from any\n// failure. The caller deletes the source directory whenever this returns\n// (false, nil), so a permission error, a read-only filesystem or a Windows","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/execenv/hermes_memory.go#L246-L282","documentation":"Returned by newHermesStoreStaging when os.MkdirAll on the store's parent directory (<profile>/hermes-state/<agent>) fails. The staging dir must be a sibling of the store so the publish rename stays on one filesystem, so the parent has to exist first; failure aborts the memory (or session-db) migration.","triggerScenarios":"os.MkdirAll on the store parent fails: a component path exists as a file, profile dir read-only or full, or the daemon user lacks write permission anywhere along <profile>/hermes-state/<agent>.","commonSituations":"Same causes as store-creation failure: service-user mismatch on ~/.multica, full container volume, or a leftover file named like the agent segment blocking the directory chain.","solutions":["Fix ownership/permissions of ~/.multica and hermes-state for the daemon user.","Check disk space and inodes on the profile-dir volume.","Remove any regular file occupying the directory path named in the error."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if err := os.MkdirAll(filepath.Dir(storeDir), 0o700); err != nil {\n    return fmt.Errorf(\"cannot prepare %s: %w\", filepath.Dir(storeDir), err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create hermes-state/<agent> during agent provisioning","Keep profile dir writable by the daemon user","Alert on disk-space/inode pressure for the profile volume"],"tags":["filesystem","hermes","migration","permissions"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}