microsoft/typescript-go · error

Kind marker ${marker.name} references undefined kind or mark

Error message

Kind marker ${marker.name} references undefined kind or marker ${marker.value}

What it means

validate() asserts every kind marker points at an existing kind or another marker. This marker's value references a kind name that isn't defined in the schema — a dangling reference in AST kind metadata.

Source

Thrown at _scripts/schema.ts:1158

            }
        }

        for (const listAlias of this.listAliases()) {
            const resolved = this.resolveType(listAlias.name);
            if (resolved.kind !== "alias" || resolved.resolved.kind !== "list") {
                throw new Error(`List alias ${listAlias.name} did not resolve to an alias of a list type`);
            }
            if (!listAlias.elementTypeName) {
                throw new Error(`List alias ${listAlias.name} is missing an element type`);
            }
            if (listAlias.elementType !== this.resolveType(listAlias.elementTypeName)) {
                throw new Error(`List alias element type cache mismatch for ${listAlias.name}`);
            }
        }

        for (const marker of this.kindMarkers()) {
            if (!this.hasKindElement(marker.value) && !this.kindMarkers().some(candidate => candidate.name === marker.value)) {
                throw new Error(`Kind marker ${marker.name} references undefined kind or marker ${marker.value}`);
            }
        }

        for (const alias of this.kindAliases()) {
            for (const member of alias.members) {
                if (!this.hasKindAlias(member) && !this.hasKindElement(member)) {
                    throw new Error(`Unknown kind alias member ${member} in ${alias.name}`);
                }
            }
        }
    }

    primitiveType(name: string): PrimitiveType {
        const existing = this.primitiveTypeMap.get(name);
        if (existing) return existing;
        const type = new PrimitiveType(this, name);
        this.primitiveTypeMap.set(name, type);
        return type;

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Fix the marker value to reference an existing kind or marker name
  2. If the kind was intentionally removed, remove the marker too
  3. Re-run the schema generation + validation pipeline before building
Defensive patterns

Strategy: validation

Validate before calling

// before validate(), assert every marker value exists:
for (const m of schema.kindMarkers()) assert(schema.hasKindElement(m.value) || schema.kindMarkers().some(c => c.name === m.value));

Prevention

When it happens

Trigger: Renaming/removing a node kind while a marker still references the old name; adding a marker with a typo'd value.

Common situations: Schema refactors that rename kinds; hand-written marker entries not covered by generation.

Related errors


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/601f05c392ef2e76. Report an issue: GitHub.