can1357/oh-my-pi · error

Memory file not found: ${url.href}

Error message

Memory file not found: ${url.href}

What it means

The memory:// handler threw this when at least one memory root exists (some artifact was found), but the specific requested memory file does not exist at any candidate location. The message includes the full href that failed to resolve.

Source

Thrown at packages/coding-agent/src/internal-urls/memory-protocol.ts:364

		for (const root of roots) {
			try {
				await fs.stat(root);
				anyExists = true;
			} catch (error) {
				if (isEnoent(error)) continue;
				throw error;
			}
			const result = await tryResolveInRoot(url, root);
			if (result) return result;
		}

		if (!anyExists) {
			throw new Error(
				"Memory artifacts are not available for this project yet. Run a session with memories enabled first.",
			);
		}

		throw new Error(`Memory file not found: ${url.href}`);
	}

	async complete(_query?: string, context?: ResolveContext): Promise<UrlCompletion[]> {
		const completions: UrlCompletion[] = [];
		if (memoryRootsForContext(context).length > 0) {
			completions.push({ value: MEMORY_NAMESPACE, description: "Project memory summary" });
		}
		if (mnemopiSessionStatesFromRegistry().length > 0) {
			completions.push({
				value: "<memory-id>",
				description: "Full mnemopi memory by id (from recall)",
			});
		}
		return completions;
	}
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Check the href in the error message and correct the memory file path.
  2. List available memory files under the project memory root and use an existing one.
  3. Recreate the memory artifact by running a session with memories enabled if it was deleted.

Example fix

// before
resolve('memory://session-summary-2025-01.md')
// after: verify the file exists first
const root = path.join(projectDir, '.omp', 'memories');
if (!fs.existsSync(path.join(root, 'session-summary-2025-01.md'))) throw new Error('memory file missing');
Defensive patterns

Strategy: try-catch

Validate before calling

const target = path.join(memoryRoot, memoryName);
if (!fs.existsSync(target)) throw new Error(`unknown memory: ${memoryName}`);

Try / catch

try {
  return await protocol.resolve(url);
} catch (err) {
  if (err instanceof Error && err.message.startsWith('Memory file not found')) {
    logger.warn('memory file missing', { href: url });
    return null;
  }
  throw err;
}

Prevention

When it happens

Trigger: Resolving memory://<path> where memory artifacts exist for the project but the requested path does not match any existing file (typo, stale reference, renamed memory).

Common situations: Referencing a memory file captured in an earlier session that was later renamed or pruned; typos in the memory path; case-sensitivity differences on Linux filesystems.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/8c0721eb74201ef0. Report an issue: GitHub.