multica-ai/multica · error

stat memories path %s: %w

Error message

stat memories path %s: %w

What it means

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.

Source

Thrown at server/internal/daemon/execenv/hermes_memory.go:171

				if err := os.MkdirAll(storeDir, 0o700); err != nil {
					return fmt.Errorf("create hermes memory store %s: %w", storeDir, err)
				}
				touchHermesMemoryStore(storeDir, logger)
				return nil
			}
		} else if fi.IsDir() {
			// Runs before the store dir is created, so migration can publish a
			// fully-copied tree with one atomic rename. Fails closed: the source
			// dir below is only removed once every entry is safely in the store.
			if err := migrateHermesTaskMemories(dst, storeDir, logger); err != nil {
				return err
			}
		}
		if err := os.RemoveAll(dst); err != nil {
			return fmt.Errorf("remove stale memories path %s: %w", dst, err)
		}
	} else if !os.IsNotExist(err) {
		return fmt.Errorf("stat memories path %s: %w", dst, err)
	}

	if err := os.MkdirAll(storeDir, 0o700); err != nil {
		return fmt.Errorf("create hermes memory store %s: %w", storeDir, err)
	}
	if err := createDirLink(storeDir, dst); err != nil {
		return fmt.Errorf("link memories to store %s: %w", storeDir, err)
	}
	// Stamp the store as just-used: mounting it does not touch its mtime, so
	// without this the GC's idle check could reclaim a long-idle agent's memory
	// right as a task picks it back up.
	touchHermesMemoryStore(storeDir, logger)
	return nil
}

// migrateHermesTaskMemories copies the contents of a pre-existing task-local
// memories dir into an empty store, so upgrading a daemon does not drop what an
// in-flight task had already remembered.

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Read the wrapped errno from the log line and fix the underlying stat problem (permissions on the parent dir, mount health, path length).
  2. Verify the overlay hermes home path is on a healthy local filesystem, not a stale network mount.
  3. If the path is corrupted/inaccessible, remove the task overlay dir so it is rebuilt clean.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight the stat before triggering a mount:
if _, err := os.Lstat(dst); err != nil && !os.IsNotExist(err) {
    return fmt.Errorf("memories path unreadable, fix %s first: %w", dst, err)
}

Try / catch

if err := mountHermesMemories(home, store, logger); err != nil {
    var perr *fs.PathError
    if errors.As(err, &perr) && errors.Is(perr.Op, "lstat") {
        // surface as environment misconfiguration, not a task failure
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/fbdf4189d653e817. Report an issue: GitHub.