yamadashy/repomix · error

File or directory not found for path: ${inputPath}

Error message

File or directory not found for path: ${inputPath}

What it means

This wraps any ENOENT (path does not exist) failure that escapes resolveOutputFilePath into a clearer message. It is thrown when the inputPath passed to the attach packed output tool is neither an existing file nor an existing directory.

Source

Thrown at src/mcp/tools/attachPackedOutputTool.ts:90

        `No repomix output file found in directory: ${inputPath}. Looking for: ${possibleFiles.join(', ')}`,
      );
    }

    // If it's a file, check if it's a supported format
    const supportedExtensions = Object.values(defaultFilePathMap).map((file) => path.extname(file));
    const fileExtension = path.extname(inputPath).toLowerCase();

    if (!supportedExtensions.includes(fileExtension)) {
      throw new Error(
        `Unsupported file format: ${fileExtension}. Supported formats: ${supportedExtensions.join(', ')}`,
      );
    }

    const format = getFormatFromExtension(fileExtension);
    return { filePath: inputPath, format };
  } catch (error) {
    if (error instanceof Error && error.message.includes('ENOENT')) {
      throw new Error(`File or directory not found for path: ${inputPath}`, { cause: error });
    }
    throw error;
  }
}

/**
 * Get format from file name
 */
function getFormatFromFileName(fileName: string): string {
  for (const [format, defaultFileName] of Object.entries(defaultFilePathMap)) {
    if (fileName === defaultFileName) {
      return format;
    }
  }
  return 'xml'; // fallback
}

/**

View on GitHub (pinned to f465ad9093)

Solutions

  1. Check the path exists: `ls -la <inputPath>`; fix typos or stale paths
  2. Use an absolute path to avoid cwd differences between CLI and MCP server
  3. Regenerate the output or recreate the directory if it was deleted
  4. Verify symlink targets exist if the path is a link

Example fix

// before
await attachPackedOutput({ path: './projct/repomix-output.xml' }); // typo
// after
await attachPackedOutput({ path: '/abs/path/to/project/repomix-output.xml' });
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs';
if (!fs.existsSync(inputPath)) throw new Error(`Path does not exist: ${inputPath}`);

Try / catch

try {
  await attachPackedOutput({ path: inputPath });
} catch (e) {
  if (/File or directory not found|ENOENT/.test(e.cause?.code ?? e.message)) {
    // fix the path (prefer absolute) and retry
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the MCP attach tool with a path that was deleted, a typo'd path, a relative path resolved against a different working directory than expected, or a symlink pointing to a removed target.

Common situations: Hardcoded absolute paths that differ between machines/CI; running the MCP server from a different cwd than the CLI; case-sensitivity mismatches on Linux for paths authored on macOS/Windows.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/83c954aeabafd9d0. Report an issue: GitHub.