{"record":{"id":"6c489cfde193ca2a","repo":"paperclipai/paperclip","slug":"name-is-required","errorCode":null,"errorMessage":"${name} is required","messagePattern":"(.+?) is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/plugin-llm-wiki/src/wiki/core.ts","lineNumber":437,"sourceCode":"  warnings: string[];\n  humanReviewRequired: boolean;\n};\ntype PaperclipEventIngestResult =\n  | { status: \"skipped\"; reason: \"disabled\" | \"source_disabled\" | \"unsupported_event\" | \"missing_issue\" | \"missing_comment\" | \"missing_document\" | \"plugin_operation\" | \"already_ingested\" }\n  | { status: \"recorded\"; sourceKind: WikiEventIngestionSource; sourceId: string; cursorId: string; issueId: string };\n\ntype WikiResourceBinding = {\n  resolvedId: string | null;\n  metadata: Record<string, unknown>;\n};\n\nfunction stringField(value: unknown): string | null {\n  return typeof value === \"string\" && value.trim().length > 0 ? value.trim() : null;\n}\n\nfunction requireString(value: unknown, name: string): string {\n  const field = stringField(value);\n  if (!field) throw new Error(`${name} is required`);\n  return field;\n}\n\nfunction normalizeWikiId(value: unknown): string {\n  return stringField(value) ?? DEFAULT_WIKI_ID;\n}\n\nexport function normalizeSpaceSlug(value: unknown): string {\n  const raw = stringField(value) ?? DEFAULT_SPACE_SLUG;\n  const normalized = raw\n    .trim()\n    .toLowerCase()\n    .replace(/[^a-z0-9]+/g, \"-\")\n    .replace(/^-+|-+$/g, \"\");\n  if (!normalized) throw new Error(\"spaceSlug is required\");\n  if (normalized.length > 64) throw new Error(\"spaceSlug must be 64 characters or fewer\");\n  return normalized;\n}","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/plugin-llm-wiki/src/wiki/core.ts#L419-L455","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nrequireString(input.maybeMissing, \"title\"); // throws if undefined\n// after\nrequireString(input.title?.trim(), \"title\");\n// or guard earlier:\nif (!input.title?.trim()) throw new Error(\"title missing from caller\");","handlingStrategy":"type-guard","validationCode":"function requireStringSafe(value: unknown, name: string): string {\n  if (typeof value !== \"string\" || !value.trim()) {\n    throw new Error(`${name} is required`);\n  }\n  return value.trim();\n}","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === \"string\" && v.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["llm-wiki","validation","string"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}