nanocoai/nanoclaw · error
Unknown provider: . Registered
Error message
Unknown provider: ${name}. Registered: ${known} What it means
parseTemplate throws when the directory passed to it does not exist on disk. This is the first check before any plugin content is read.
Solutions
- Verify the path exists: ls the printed directory
- Re-fetch/install the template from the template library
- If relative, ensure you're running from the expected cwd or use an absolute path
Defensive patterns
Strategy: validation
Validate before calling
if (!fs.existsSync(dir)) {
// fetch/install the template or fail with a friendly message before parseTemplate
} Type guard
function dirExists(p: string): boolean { try { return fs.statSync(p).isDirectory(); } catch { return false; } } Try / catch
try { parseTemplate(dir); } catch (e) { if (e instanceof Error && e.message.startsWith('Template folder not found')) { /* trigger install flow */ } else throw e; } Prevention
- Resolve template paths to absolute form at config-load time and assert existence early
- Keep template installation idempotent so a missing dir self-heals
When it happens
Trigger: Calling parseTemplate with a typo'd path, a template that was never fetched, or a path from stale config after the template was deleted/moved.
Common situations: Template library not cloned; path stored in DB/config points at a removed directory; relative path resolved from the wrong cwd.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- chat-sdk bridge instance
- -- must be a number
- engage_mode 'pattern' requires --engage-pattern (use "." to…
- engage_mode ' ' can never engage on channel ' ' — its…
- /context/instructions.md must be a regular file
AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28).
Data as JSON: /api/errors/da17db7dd737b065.
Report an issue: GitHub.
Appendix: source
Thrown at container/agent-runner/src/providers/provider-registry.ts:26
*/
import type { AgentProvider, ProviderOptions } from './types.js';
export type ProviderFactory = (options: ProviderOptions) => AgentProvider;
const registry = new Map<string, ProviderFactory>();
export function registerProvider(name: string, factory: ProviderFactory): void {
if (registry.has(name)) {
throw new Error(`Provider already registered: ${name}`);
}
registry.set(name, factory);
}
export function getProviderFactory(name: string): ProviderFactory {
const factory = registry.get(name);
if (!factory) {
const known = [...registry.keys()].join(', ') || '(none)';
throw new Error(`Unknown provider: ${name}. Registered: ${known}`);
}
return factory;
}
export function listProviderNames(): string[] {
return [...registry.keys()];
}
View on GitHub (pinned to 294ef2aee8)