paperclipai/paperclip · error · Error
${name} is required
Error message
${name} is required What it means
Thrown by the requireString() helper in plugin-llm-wiki/src/wiki/core.ts when the supplied value is not a non-empty trimmed string (it delegates to stringField(), which returns null for non-strings or whitespace-only values). It is a generic guard used across wiki normalization for any field that must be present. The interpolated name identifies which field failed.
Source
Thrown at packages/plugins/plugin-llm-wiki/src/wiki/core.ts:437
warnings: string[];
humanReviewRequired: boolean;
};
type PaperclipEventIngestResult =
| { status: "skipped"; reason: "disabled" | "source_disabled" | "unsupported_event" | "missing_issue" | "missing_comment" | "missing_document" | "plugin_operation" | "already_ingested" }
| { status: "recorded"; sourceKind: WikiEventIngestionSource; sourceId: string; cursorId: string; issueId: string };
type WikiResourceBinding = {
resolvedId: string | null;
metadata: Record<string, unknown>;
};
function stringField(value: unknown): string | null {
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
}
function requireString(value: unknown, name: string): string {
const field = stringField(value);
if (!field) throw new Error(`${name} is required`);
return field;
}
function normalizeWikiId(value: unknown): string {
return stringField(value) ?? DEFAULT_WIKI_ID;
}
export function normalizeSpaceSlug(value: unknown): string {
const raw = stringField(value) ?? DEFAULT_SPACE_SLUG;
const normalized = raw
.trim()
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
if (!normalized) throw new Error("spaceSlug is required");
if (normalized.length > 64) throw new Error("spaceSlug must be 64 characters or fewer");
return normalized;
}View on GitHub (pinned to 67001ec6eb)
Solutions
- Supply a non-empty string value for the named field before calling the API.
- Default the field upstream if optional (e.g. value ?? fallback) before passing it in.
- Validate the inbound payload with a schema (zod/json-schema) that rejects missing/blank strings at the boundary.
Example fix
// before
requireString(input.maybeMissing, "title"); // throws if undefined
// after
requireString(input.title?.trim(), "title");
// or guard earlier:
if (!input.title?.trim()) throw new Error("title missing from caller"); Defensive patterns
Strategy: type-guard
Validate before calling
function requireStringSafe(value: unknown, name: string): string {
if (typeof value !== "string" || !value.trim()) {
throw new Error(`${name} is required`);
}
return value.trim();
} Type guard
function isNonEmptyString(v: unknown): v is string {
return typeof v === "string" && v.trim().length > 0;
} Prevention
- Validate required string fields at the payload boundary with a schema.
- Default optional fields upstream rather than passing undefined.
- Prefer type guards over the throwing helper in branches where absence is legitimate.
When it happens
Trigger: Calling code passes undefined, null, an empty string, a whitespace-only string, or a non-string type (number/object) to a requireString-guarded field. Reading a field from user-supplied config that was omitted.
Common situations: Plugin config missing a required key. API payload where a required string field was nulled by JSON parsing or stripped by sanitization. Migration where a field changed from optional to required.
Related errors
- Ingest operation did not return an issue id; the dropped fil
- spaceSlug is required
- spaceSlug must be 64 characters or fewer
- Paperclip source scope must specify either projectId or root
- ${name} must be a positive number.
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/6c489cfde193ca2a.
Report an issue: GitHub.