{"record":{"id":"096f8cb07ea23817","repo":"can1357/oh-my-pi","slug":"missing-built-in-keyword-name","errorCode":null,"errorMessage":"missing built-in keyword ${name}","messagePattern":"missing built-in keyword (.+?)","errorType":"exception","errorClass":"OmpTypeError","httpStatus":null,"severity":"error","filePath":"packages/omptype/src/type.ts","lineNumber":2794,"sourceCode":"\treadonly numeric: ParsedStringKeyword<number>;\n\treadonly regex: FluentType<string>;\n\treadonly semver: FluentType<string>;\n\treadonly trim: PreformattedKeyword;\n\treadonly upper: PreformattedKeyword;\n\treadonly url: ParsedStringKeyword<URL>;\n\treadonly uuid: UuidKeyword;\n}\n\n/** Number keyword module attached to `type.number`. */\nexport interface NumberKeyword extends FluentType<number> {\n\treadonly integer: FluentType<number>;\n}\n\ntype Constructed<ctor> = ctor extends abstract new (...args: never[]) => infer instance ? instance : never;\n\nfunction keywordSchema<output = string, input = output>(name: string): FluentType<output, input> {\n\tconst ir = keywordIR(name);\n\tif (ir === undefined) throw new OmpTypeError(`missing built-in keyword ${name}`);\n\treturn makeType<output, input>(ir, [], {});\n}\n\nfunction parsedKeyword<parsed>(name: string): ParsedStringKeyword<parsed> {\n\treturn Object.assign(keywordSchema<string>(name), {\n\t\tparse: keywordSchema<parsed, string>(`${name}.parse`),\n\t});\n}\n\nfunction preformattedKeyword(name: string): PreformattedKeyword {\n\treturn Object.assign(keywordSchema<string, string>(name), {\n\t\tpreformatted: keywordSchema(`${name}.preformatted`),\n\t});\n}\n\ntype MatchDefault<input = unknown, output = unknown> =\n\t| \"assert\"\n\t| \"never\"","sourceCodeStart":2776,"sourceCodeEnd":2812,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/omptype/src/type.ts#L2776-L2812","documentation":"keywordSchema() looks up a built-in keyword's IR via keywordIR(name); if the keyword is not registered, it throws OmpTypeError. Only names present in the built-in keyword table (string, number, boolean, etc.) are valid; anything else must go through parseDef or a user-defined alias.","triggerScenarios":"Calling keywordSchema()/parsedKeyword()/fluent keyword helpers with a name that isn't a built-in, e.g. keywordSchema('strn'), or a keyword removed/renamed in a newer library version.","commonSituations":"Typo'd keyword names; building keyword names dynamically from config/data; version upgrades where a keyword was renamed or an unregistered custom keyword was assumed to be built-in.","solutions":["Use an exact built-in keyword name (check the library's keyword table/docs)","Fix typos in the keyword string","For custom names, register an alias with the type registry instead of calling keywordSchema directly","If upgrading, check the changelog for renamed/removed keywords and update call sites"],"exampleFix":"// before\nconst s = keywordSchema('strn'); // throws\n// after\nconst s = keywordSchema('string');","handlingStrategy":"fallback","validationCode":"import { type } from '@oh-my-pi/omptype';\nfunction safeKeyword(name: string) {\n  try {\n    const t = type(name);\n    return t;\n  } catch {\n    return null; // not a built-in keyword\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const s = keywordSchema(name);\n} catch (err) {\n  if (err instanceof OmpTypeError && err.message.startsWith('missing built-in keyword')) {\n    return type(name); // route unknown names through the parser / alias registry\n  }\n  throw err;\n}","preventionTips":["Keep a checked list of valid keyword names and validate against it","Never build keyword names by string concatenation without verification","On upgrades, diff your keyword usage against the library's keyword table"],"tags":["keywords","schema","typo","omptype"],"backgroundTag":"unknown-type-keyword","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}