paperclipai/paperclip · error · Error
Invalid template '${template}'. Expected one of: ${VALID_TEM
Error message
Invalid template '${template}'. Expected one of: ${VALID_TEMPLATES.join(", ")} What it means
scaffoldPluginProject only accepts template values from the fixed set VALID_TEMPLATES = ['default','connector','workspace','environment'] and rejects anything else with a message listing the allowed values. The check runs before name/category validation and before any filesystem writes.
Source
Thrown at packages/plugins/create-paperclip-plugin/src/index.ts:126
const tarballPath = path.join(sdkBundleDir, tarballFileName);
if (!fs.existsSync(tarballPath)) {
throw new Error(`Packed tarball was not created at ${tarballPath}`);
}
return tarballPath;
}
/**
* Generate a complete Paperclip plugin starter project.
*
* Output includes manifest/worker/UI entries, SDK harness tests, bundler presets,
* and a local dev server script for hot-reload workflow.
*/
export function scaffoldPluginProject(options: ScaffoldPluginOptions): string {
const template = options.template ?? "default";
if (!VALID_TEMPLATES.includes(template)) {
throw new Error(`Invalid template '${template}'. Expected one of: ${VALID_TEMPLATES.join(", ")}`);
}
if (!isValidPluginName(options.pluginName)) {
throw new Error("Invalid plugin name. Must be lowercase and may include scope, dots, underscores, or hyphens.");
}
if (options.category && !VALID_CATEGORIES.has(options.category)) {
throw new Error(`Invalid category '${options.category}'. Expected one of: ${[...VALID_CATEGORIES].join(", ")}`);
}
const outputDir = path.resolve(options.outputDir);
if (fs.existsSync(outputDir)) {
throw new Error(`Directory already exists: ${outputDir}`);
}
const displayName = options.displayName ?? makeDisplayName(options.pluginName);
const description = options.description ?? "A Paperclip plugin";
const author = options.author ?? "Plugin Author";View on GitHub (pinned to 67001ec6eb)
Solutions
- Use one of: default, connector, workspace, environment.
- Omit template entirely to get the 'default' template.
- If you need a custom layout, scaffold 'default' and modify the output.
Example fix
// before
scaffoldPluginProject({ pluginName: 'foo', template: 'typescript' })
// after
scaffoldPluginProject({ pluginName: 'foo', template: 'default' }) Defensive patterns
Strategy: validation
Validate before calling
const VALID_TEMPLATES = ['default','connector','workspace','environment'] as const;
function isTemplate(v: unknown): v is typeof VALID_TEMPLATES[number] {
return typeof v === 'string' && (VALID_TEMPLATES as readonly string[]).includes(v);
}
const template = isTemplate(options.template) ? options.template : 'default'; Type guard
function isPluginTemplate(v: unknown): v is 'default'|'connector'|'workspace'|'environment' {
return v === 'default' || v === 'connector' || v === 'workspace' || v === 'environment';
} Prevention
- Restrict the UI/CLI choices to the four valid templates.
- Omit template to use 'default' when unsure.
- Keep docs in sync with VALID_TEMPLATES after any rename.
When it happens
Trigger: Calling scaffoldPluginProject with options.template set to a value not in the set (e.g. 'typescript', 'worker', 'react', or a typo like 'conector').
Common situations: User passes a template name from a different tool's docs; CLI flag --template was given an unsupported value; outdated docs list a template that was renamed/removed.
Related errors
- Invalid plugin name. Must be lowercase and may include scope
- Package package.json not found at ${packageJsonPath}
- Packed tarball was not created at ${tarballPath}
- Profile name is required
- Invalid --persona value. Use board or agent.
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/236ee5a8ecbb3c40.
Report an issue: GitHub.