{"record":{"id":"fbdf4189d653e817","repo":"multica-ai/multica","slug":"stat-memories-path-s-w","errorCode":null,"errorMessage":"stat memories path %s: %w","messagePattern":"stat memories path (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/execenv/hermes_memory.go","lineNumber":171,"sourceCode":"\t\t\t\tif err := os.MkdirAll(storeDir, 0o700); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"create hermes memory store %s: %w\", storeDir, err)\n\t\t\t\t}\n\t\t\t\ttouchHermesMemoryStore(storeDir, logger)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else if fi.IsDir() {\n\t\t\t// Runs before the store dir is created, so migration can publish a\n\t\t\t// fully-copied tree with one atomic rename. Fails closed: the source\n\t\t\t// dir below is only removed once every entry is safely in the store.\n\t\t\tif err := migrateHermesTaskMemories(dst, storeDir, logger); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif err := os.RemoveAll(dst); err != nil {\n\t\t\treturn fmt.Errorf(\"remove stale memories path %s: %w\", dst, err)\n\t\t}\n\t} else if !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"stat memories path %s: %w\", dst, err)\n\t}\n\n\tif err := os.MkdirAll(storeDir, 0o700); err != nil {\n\t\treturn fmt.Errorf(\"create hermes memory store %s: %w\", storeDir, err)\n\t}\n\tif err := createDirLink(storeDir, dst); err != nil {\n\t\treturn fmt.Errorf(\"link memories to store %s: %w\", storeDir, err)\n\t}\n\t// Stamp the store as just-used: mounting it does not touch its mtime, so\n\t// without this the GC's idle check could reclaim a long-idle agent's memory\n\t// right as a task picks it back up.\n\ttouchHermesMemoryStore(storeDir, logger)\n\treturn nil\n}\n\n// migrateHermesTaskMemories copies the contents of a pre-existing task-local\n// memories dir into an empty store, so upgrading a daemon does not drop what an\n// in-flight task had already remembered.","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/execenv/hermes_memory.go#L153-L189","documentation":"Returned by mountHermesMemories when os.Lstat on the overlay's memories path fails with anything other than not-exist. The function branches on stat (symlink to store vs real dir vs absent), so an unreadable stat means it cannot decide safely and fails the overlay build rather than guessing.","triggerScenarios":"os.Lstat(<hermes-home>/memories) returns EACCES (parent dir not searchable), EIO (disk/NFS error), or ENAMETOOLONG on a corrupted overlay path; any errno besides ENOENT.","commonSituations":"Overlay home directory created with restrictive ownership by a different daemon user; disk corruption or a failing NFS mount under the multica profile dir; path-length limits hit on Windows deep task paths.","solutions":["Read the wrapped errno from the log line and fix the underlying stat problem (permissions on the parent dir, mount health, path length).","Verify the overlay hermes home path is on a healthy local filesystem, not a stale network mount.","If the path is corrupted/inaccessible, remove the task overlay dir so it is rebuilt clean."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-flight the stat before triggering a mount:\nif _, err := os.Lstat(dst); err != nil && !os.IsNotExist(err) {\n    return fmt.Errorf(\"memories path unreadable, fix %s first: %w\", dst, err)\n}","typeGuard":null,"tryCatchPattern":"if err := mountHermesMemories(home, store, logger); err != nil {\n    var perr *fs.PathError\n    if errors.As(err, &perr) && errors.Is(perr.Op, \"lstat\") {\n        // surface as environment misconfiguration, not a task failure\n    }\n}","preventionTips":["Keep the multica profile dir on a healthy local filesystem","Use one OS user for all daemon invocations","Monitor disk health under the profile dir"],"tags":["filesystem","hermes","stat","permissions"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}