{"record":{"id":"26a4a9fb88a06a82","repo":"can1357/oh-my-pi","slug":"alias-entry-name-is-not-generic","errorCode":null,"errorMessage":"alias \"${entry.name}\" is not generic","messagePattern":"alias \"(.+?)\" is not generic","errorType":"exception","errorClass":"OmpTypeError","httpStatus":null,"severity":"error","filePath":"packages/omptype/src/type.ts","lineNumber":3865,"sourceCode":"\t\tconst reference: IR = {\n\t\t\tk: \"alias\",\n\t\t\tname,\n\t\t\tresolve: () => {\n\t\t\t\tconst target = targets.get(name);\n\t\t\t\tif (target !== undefined) return target;\n\t\t\t\tconst parsed = parseDef(definition, resolve);\n\t\t\t\ttargets.set(name, parsed);\n\t\t\t\treturn parsed;\n\t\t\t},\n\t\t};\n\t\treferences.set(name, reference);\n\t\treturn reference;\n\t}) as AliasResolver;\n\n\tconst genericFor = (entry: ScopeAlias): RuntimeGeneric => {\n\t\tif (entry.generic !== undefined) return entry.generic;\n\t\tconst parameters = entry.genericParameters;\n\t\tif (parameters === undefined) throw new OmpTypeError(`alias \"${entry.name}\" is not generic`);\n\t\tentry.generic = createRuntimeGeneric(parameters, entry.definition, resolve, false);\n\t\treturn entry.generic;\n\t};\n\tconst genericInstantiations = new Map<string, IR>();\n\tresolve.hasGeneric = name => entries.get(name)?.genericParameters !== undefined;\n\tresolve.generic = (name, arguments_) => {\n\t\tconst entry = entries.get(name);\n\t\tif (entry === undefined || entry.genericParameters === undefined) return undefined;\n\t\tconst key = `${name}<${arguments_.map(expectedOf).join(\",\")}>`;\n\t\tconst existing = genericInstantiations.get(key);\n\t\tif (existing !== undefined) return existing;\n\t\tlet target: IR | undefined;\n\t\tconst reference: IR = {\n\t\t\tk: \"alias\",\n\t\t\tname: key,\n\t\t\tresolve: () => {\n\t\t\t\ttarget ??= genericFor(entry)[GENERIC_META].instantiateIR(arguments_);\n\t\t\t\treturn target;","sourceCodeStart":3847,"sourceCodeEnd":3883,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/omptype/src/type.ts#L3847-L3883","documentation":"When a scope resolves a reference to an alias that was declared without generic parameters, but the resolution machinery expects it to be a runtime generic (i.e., the reference uses generic instantiation syntax), omptype throws. The alias has no `genericParameters`, so it cannot be instantiated with type arguments.","triggerScenarios":"Referencing an alias with generic arguments inside a scope while the alias definition itself declares no parameters, e.g. scope `{ box: { value: \"string\" }, use: \"box<string>\" }` — `box` is not generic.","commonSituations":"Renaming/rewriting a generic alias to a concrete one but forgetting to update call sites that still use `<...>` instantiation; copying a reference from another scope where the alias was generic.","solutions":["Remove the `<...>` arguments from the reference: use `\"box\"` instead of `\"box<string>\"`.","Make the alias generic by declaring parameters: `{ \"box<T>\": { value: \"T\" } }`.","Grep the scope definitions for instantiation syntax on the named alias and fix all call sites."],"exampleFix":"// before\ntype.scope({ \"box\": { value: \"string\" }, \"use\": \"box<string>\" })\n// after\ntype.scope({ \"box\": { value: \"string\" }, \"use\": \"box\" })","handlingStrategy":"validation","validationCode":"const isGenericRef = (def: string) => /\\w+<.+>/.test(def); // if true, the referenced alias must be declared with <T> parameters","typeGuard":null,"tryCatchPattern":"try { const $ = type.scope(defs); } catch (e) { if (e instanceof OmpTypeError && e.message.includes('is not generic')) removeInstantiationArgs(e.message); else throw e; }","preventionTips":["Whenever you de-generalize an alias, search the scope for '<...>' references to it","Declare generic aliases as \"name<T>\" keys in the scope","Keep scope alias declarations and their references in the same module so refactors touch both"],"tags":["generics","scope","alias","schema"],"backgroundTag":"alias-not-generic","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}