multica-ai/multica · error

read shared .env: %w

Error message

read shared .env: %w

What it means

Error "read shared .env: %w" thrown in multica-ai/multica.

Source

Thrown at server/internal/daemon/execenv/hermes_home.go:458

// writeDerivedHermesEnv writes the task-local .env: the source home's .env
// contents (credentials/settings preserved) with any HERMES_HOME assignment
// removed, then a pinned HERMES_HOME pointing at the overlay appended last so it
// wins. Hermes loads <HERMES_HOME>/.env with override=True right after profile
// resolution, so without this an out-of-band HERMES_HOME= in the source .env
// would relocate the home past the overlay (dropping bound skills and memory
// isolation). We always write the file — even when the source has none — so the
// overlay .env "loads" and Hermes' project-.env fallback (override=True only when
// no user .env loaded) can't relocate the home either. Written 0600 via atomic
// replace since it can hold API-key secrets; reuse also repairs prior perms.
func writeDerivedHermesEnv(sharedHome, hermesHome string) error {
	dst := filepath.Join(hermesHome, ".env")

	var body []byte
	src, err := os.ReadFile(filepath.Join(sharedHome, ".env"))
	if err != nil {
		if !os.IsNotExist(err) {
			return fmt.Errorf("read shared .env: %w", err)
		}
	} else {
		body = stripDotenvAssignment(src, "HERMES_HOME")
	}

	var buf strings.Builder
	if len(body) > 0 {
		buf.Write(body)
		if body[len(body)-1] != '\n' {
			buf.WriteByte('\n')
		}
	}
	// Pin HERMES_HOME to the overlay. Single-quote the value so python-dotenv
	// treats it literally (no escaping / var expansion) — task home paths can
	// contain spaces or other characters under the workspaces root.
	fmt.Fprintf(&buf, "HERMES_HOME='%s'\n", hermesHome)

	return writeFileAtomic(dst, []byte(buf.String()), 0o600)

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Check that the shared .env file is readable.

When it happens

Trigger: Thrown at server/internal/daemon/execenv/hermes_home.go:458 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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