angular/angular · error · FatalLinkerError

Unsupported type, its name could not be determined

Error message

Unsupported type, its name could not be determined

What it means

Thrown by the Angular partial-declaration linker when converting a ɵɵngDeclareInjector declaration (the injector of an NgModule) into R3InjectorMetadata. The `type` field must be a direct reference to the NgModule class so its name can be extracted; a value with no resolvable symbol name causes FatalLinkerError and fails the application build.

Source

Thrown at packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_injector_linker_1.ts:45

  linkPartialDeclaration(
    constantPool: ConstantPool,
    metaObj: AstObject<R3PartialDeclaration, TExpression>,
  ): LinkedDefinition {
    const meta = toR3InjectorMeta(metaObj);
    return compileInjector(meta);
  }
}

/**
 * Derives the `R3InjectorMetadata` structure from the AST object.
 */
export function toR3InjectorMeta<TExpression>(
  metaObj: AstObject<R3DeclareInjectorMetadata, TExpression>,
): R3InjectorMetadata {
  const typeExpr = metaObj.getValue('type');
  const typeName = typeExpr.getSymbolName();
  if (typeName === null) {
    throw new FatalLinkerError(
      typeExpr.expression,
      'Unsupported type, its name could not be determined',
    );
  }

  return {
    name: typeName,
    type: wrapReference(typeExpr.getOpaque()),
    providers: metaObj.has('providers') ? metaObj.getOpaque('providers') : null,
    imports: metaObj.has('imports') ? metaObj.getArray('imports').map((i) => i.getOpaque()) : [],
  };
}

View on GitHub (pinned to 51cb07e980)

Solutions

  1. Rebuild and republish the library with a compatible Angular compiler
  2. Point `type` at the NgModule class directly in hand-written declarations
  3. Upgrade the application's Angular toolchain
  4. Avoid transforming/minifying published library output

Example fix

// before
ɵɵngDeclareInjector({ ..., type: modules['AppModule'] });
// after
ɵɵngDeclareInjector({ ..., type: AppModule });
Defensive patterns

Strategy: validation

Validate before calling

// Generator sanity check for injector declarations
if (!('name' in (injectorMeta.type ?? {})) && typeof injectorMeta.type !== 'string') {
  throw new Error('ɵɵngDeclareInjector `type` must reference the NgModule class directly');
}

Type guard

function isClassIdentifier(node: unknown): node is {type: 'Identifier'; name: string} {
  return !!node && typeof node === 'object' && (node as any).type === 'Identifier';
}

Try / catch

try {
  fileLinker.linkPartialDeclaration(fnName, args, scope);
} catch (e) {
  if (e instanceof FatalLinkerError && /its name could not be determined/.test(e.message)) {
    // injector `type` was not a named reference — fix the generator/library
  }
  throw e;
}

Prevention

When it happens

Trigger: An injector declaration whose `type` is not a plain class reference — object literal, call expression, conditional, or minifier-mangled identifier. Compiler-generated declarations always use `type: MyModule`.

Common situations: Hand-written ɵɵngDeclareInjector metadata; libraries post-processed by bundlers before publishing; linking against a library compiled with an incompatible Angular version.

Related errors


AI-assisted analysis of angular/angular@51cb07e980 (2026-08-22). Data as JSON: /api/errors/1cedda8917c6537c. Report an issue: GitHub.