JuliusBrussee/caveman · error · Error
project name must contain a letter or number
Error message
project name must contain a letter or number
What it means
safeName sanitizes the project name (lowercase, non [a-z0-9_-] collapsed to hyphens, trimmed hyphens). If nothing alphanumeric survives — e.g. the name was all punctuation or only hyphens — it throws because the package/dir name would be unusable.
Solutions
- Provide a project name containing at least one letter or digit, e.g. `my-app`
- Avoid symbol-only names; let safeName normalize valid mixed names
- Quote names with spaces and ensure they include alphanumeric characters
Example fix
// before npm create @caveman-ai/agent@latest '!!!' -- // after npm create @caveman-ai/agent@latest my-app --
Defensive patterns
Strategy: validation
Validate before calling
const normalized = projectName.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
if (!normalized) throw new Error("project name must contain a letter or number"); Type guard
function isValidProjectName(name: string): boolean {
return /[a-z0-9]/i.test(name);
} Try / catch
try {
const opts = parseArgs(argv);
} catch (error) {
if (error instanceof Error && error.message.includes("project name must contain")) {
console.error("Choose a project name with at least one letter or digit");
process.exitCode = 1;
} else throw error;
} Prevention
- Pick plain alphanumeric names like my-app up front
- Check shell quoting when names include special characters
- Sanitize user-supplied names in scripts before passing them
When it happens
Trigger: Passing a positional project name consisting solely of symbols/hyphens (e.g. `---`, `!!!`, `@@@`), or characters that all get stripped so the normalized result is empty.
Common situations: Shell quoting mistakes leaving an empty/odd argument; trying to name a project with emojis or punctuation only; a variable expanding to a symbol-only string.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- at least one report path and the canonical span fixture…
- at least one sink id is required
- base and head must be full Git object IDs
- cave_live_eval_sandbox_profile_invalid
- caveman agent: entry must export default agent()
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/6f0d78eb5fc70cca.
Report an issue: GitHub.
Appendix: source
Thrown at packages/create-caveman-agent/src/index.ts:307
`,
};
}
function credentialName(provider: Provider): string {
if (provider === "anthropic") return "ANTHROPIC_API_KEY";
if (provider === "openai") return "OPENAI_API_KEY";
return "GEMINI_API_KEY (or GOOGLE_API_KEY)";
}
function parseProvider(value: string): Provider {
const normalized = value.trim().toLowerCase();
if (normalized === "anthropic" || normalized === "openai" || normalized === "google") return normalized;
throw new Error(`unsupported provider ${JSON.stringify(value)}`);
}
function safeName(value: string): string {
const normalized = value.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
if (!normalized) throw new Error("project name must contain a letter or number");
return normalized.slice(0, 96);
}
async function assertAbsent(path: string): Promise<void> {
try {
await stat(path);
throw new Error(`target already exists: ${path}`);
} catch (error) {
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
}
}
main().catch((error) => {
const message = error instanceof Error ? error.message : String(error);
process.stderr.write(`create-caveman-agent: ${message}\n`);
process.exitCode = 1;
});
View on GitHub (pinned to 3ee70a1026)