can1357/oh-my-pi · error · OmpTypeError
missing built-in keyword ${name}
Error message
missing built-in keyword ${name} What it means
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.
Source
Thrown at packages/omptype/src/type.ts:2794
readonly numeric: ParsedStringKeyword<number>;
readonly regex: FluentType<string>;
readonly semver: FluentType<string>;
readonly trim: PreformattedKeyword;
readonly upper: PreformattedKeyword;
readonly url: ParsedStringKeyword<URL>;
readonly uuid: UuidKeyword;
}
/** Number keyword module attached to `type.number`. */
export interface NumberKeyword extends FluentType<number> {
readonly integer: FluentType<number>;
}
type Constructed<ctor> = ctor extends abstract new (...args: never[]) => infer instance ? instance : never;
function keywordSchema<output = string, input = output>(name: string): FluentType<output, input> {
const ir = keywordIR(name);
if (ir === undefined) throw new OmpTypeError(`missing built-in keyword ${name}`);
return makeType<output, input>(ir, [], {});
}
function parsedKeyword<parsed>(name: string): ParsedStringKeyword<parsed> {
return Object.assign(keywordSchema<string>(name), {
parse: keywordSchema<parsed, string>(`${name}.parse`),
});
}
function preformattedKeyword(name: string): PreformattedKeyword {
return Object.assign(keywordSchema<string, string>(name), {
preformatted: keywordSchema(`${name}.preformatted`),
});
}
type MatchDefault<input = unknown, output = unknown> =
| "assert"
| "never"View on GitHub (pinned to 9690622007)
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
Example fix
// before
const s = keywordSchema('strn'); // throws
// after
const s = keywordSchema('string'); Defensive patterns
Strategy: fallback
Validate before calling
import { type } from '@oh-my-pi/omptype';
function safeKeyword(name: string) {
try {
const t = type(name);
return t;
} catch {
return null; // not a built-in keyword
}
} Try / catch
try {
const s = keywordSchema(name);
} catch (err) {
if (err instanceof OmpTypeError && err.message.startsWith('missing built-in keyword')) {
return type(name); // route unknown names through the parser / alias registry
}
throw err;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- mapped property ${String(property.key)} has invalid kind
- mapped property ${String(property.key)} must contain a schem
- intersection has no satisfiable branches
- ParseError: Invalid intersection of default values ${String(
- cannot apply numeric bound to ${ir.k}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/096f8cb07ea23817.
Report an issue: GitHub.