affaan-m/ECC · error · Error
Agents directory not found
Error message
Agents directory not found: ${dirPath} What it means
ensureDirectory throws when the resolved agents directory (default .gemini/agents under cwd, or the positional argument) does not exist on disk. The faulting input is dirPath; the adaptation step needs existing agent files to rewrite.
Solutions
- Create the directory or run the step that copies agents into .gemini/agents first.
- Verify the path passed as the positional argument is correct and spelled right.
- Check cwd — the default is relative to the current working directory.
Example fix
// before $ node scripts/gemini-adapt-agents.js ./nonexistent Error: Agents directory not found: ./nonexistent // after $ mkdir -p .gemini/agents && node scripts/gemini-adapt-agents.js
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
const dir = process.argv[2] || '.gemini/agents';
if (!fs.existsSync(dir)) {
console.error(`Create it first: mkdir -p ${dir}`);
process.exit(1);
} Type guard
const isExistingDirectory = (p) => fs.existsSync(p) && fs.statSync(p).isDirectory();
Try / catch
try {
adaptAgents(argv);
} catch (err) {
if (/^Agents directory not found:/.test(err.message)) {
console.error(`${err.message}\nRun: mkdir -p ${dir}`);
process.exit(1);
}
throw err;
} Prevention
- Run `mkdir -p .gemini/agents` before invoking the script in a fresh repo.
- Execute the script from the repository root.
- Verify the path with `ls -d <dir>` first, watching for case-sensitivity.
- Initialize Gemini config via the ECC installer rather than hand-rolling paths.
When it happens
Trigger: Passing an --agents-dir/positional path that was never created, running from the wrong working directory so the default `.gemini/agents` doesn't exist there, or a typo'd path.
Common situations: Fresh clones that don't include .gemini/agents, running the script in a repo that hasn't been initialized for Gemini, path typos, or case-sensitivity mismatches on Linux.
Related errors
- Codex returned no final response
- --all-harnesses and --harness are mutually exclusive.
- all overlays must be readable local files
- all takes must be readable local files
- AMBIGUOUS_PLUGIN_SCOPES
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/fcb21c127839f998.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/gemini-adapt-agents.js:49
function parseArgs(argv) {
if (argv.includes('--help') || argv.includes('-h')) {
return { help: true };
}
const positional = argv.filter(arg => !arg.startsWith('-'));
if (positional.length > 1) {
throw new Error('Expected at most one agents directory argument');
}
return {
help: false,
agentsDir: path.resolve(positional[0] || path.join(process.cwd(), '.gemini', 'agents')),
};
}
function ensureDirectory(dirPath) {
if (!fs.existsSync(dirPath)) {
throw new Error(`Agents directory not found: ${dirPath}`);
}
if (!fs.statSync(dirPath).isDirectory()) {
throw new Error(`Expected a directory: ${dirPath}`);
}
}
function parseToolList(line) {
const match = line.match(/^\s*tools\s*:\s*(.*)$/);
if (!match) {
return null;
}
return normalizeAgentTools(match[1]);
}
function adaptToolName(toolName) {
const mapped = TOOL_NAME_MAP.get(toolName);View on GitHub (pinned to 8321021c54)