openai/codex · error · MemoriesBackendError

path '{path}' was not found

Error message

path '{path}' was not found

What it means

A memory store path referenced by read (or a scoped list/search) does not exist. The backend resolves relative paths against its store root and nothing matched.

Source

Thrown at codex-rs/ext/memories/src/backend.rs:147

    pub match_line_number: usize,
    pub content_start_line_number: usize,
    pub content: String,
    pub matched_queries: Vec<String>,
}

#[derive(Debug, thiserror::Error)]
pub enum MemoriesBackendError {
    #[error("filename '{filename}' {reason}")]
    InvalidFilename { filename: String, reason: String },
    #[error("ad-hoc note must not be empty")]
    EmptyAdHocNote,
    #[error("ad-hoc note '{filename}' already exists")]
    AdHocNoteAlreadyExists { filename: String },
    #[error("path '{path}' {reason}")]
    InvalidPath { path: String, reason: String },
    #[error("cursor '{cursor}' {reason}")]
    InvalidCursor { cursor: String, reason: String },
    #[error("path '{path}' was not found")]
    NotFound { path: String },
    #[error("line_offset must be a 1-indexed line number")]
    InvalidLineOffset,
    #[error("max_lines must be a positive integer")]
    InvalidMaxLines,
    #[error("line_offset exceeds file length")]
    LineOffsetExceedsFileLength,
    #[error("path '{path}' is not a file")]
    NotFile { path: String },
    #[error("queries must not be empty or contain empty strings")]
    EmptyQuery,
    #[error("all_within_lines.line_count must be a positive integer")]
    InvalidMatchWindow,
    #[error("I/O error while reading memories: {0}")]
    Io(#[from] std::io::Error),
}

impl MemoriesBackendError {

View on GitHub (pinned to 339751715c)

Solutions

  1. List the parent path to see what actually exists.
  2. Fix the path spelling or extension.
  3. If the store moved, point the backend at the correct root.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm existence via listing before reading a remembered path
let parent = parent_of(&path);
let listing = backend.list(ListMemoriesRequest { path: Some(parent), cursor: None, max_results: 1000 }).await?;
if !listing.entries.iter().any(|e| e.path == path) {
    return Err(MemoriesBackendError::NotFound { path }.into());
}

Try / catch

match backend.read(req).await {
    Err(MemoriesBackendError::NotFound { path }) => {
        // fall back to discovery instead of hard-failing the agent turn
        suggest_similar_paths(&path)
    }
    r => r,
}

Prevention

When it happens

Trigger: read with a typo'd path, a file deleted between listing and reading, or a path rooted at the wrong base.

Common situations: Misspelled filenames; paths from a previous session's listing; store directory moved or rotated.

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 openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/0a14ce463844c062. Report an issue: GitHub.