pulumi/pulumi · error

unknown node type: %T

Error message

unknown node type: %T

What it means

The interpreter's DAG walk switches on pcl.Node concrete types (ConfigVariable, LocalVariable, Resource, ReadResource, Component, OutputVariable, etc.). If a node's concrete type is not one of the handled cases, the default branch throws "unknown node type: %T" embedding the Go type. This indicates the PCL binder produced a node type the interpreter does not know how to execute — usually a version mismatch or an unimplemented program construct.

Solutions

  1. Read the %T in the message to identify the unhandled node type
  2. Upgrade the pulumi/pulumi dependency so interpreter and pcl binder versions match
  3. Rewrite the program to avoid the unsupported construct (e.g. inline the invoke/import instead of using the newer syntax)
  4. Add a case for the node type in the walk switch if you own the interpreter code

Example fix

// before: relying on an unsupported new node type
// pcl program uses `import` statement the interpreter can't execute
// after: inline the equivalent code
// replace the import with the component/resource declarations inline
Defensive patterns

Strategy: type-guard

Validate before calling

// pre-scan program nodes for types the interpreter cannot handle
for _, node := range program.Nodes {
    switch node.(type) {
    case *pcl.ConfigVariable, *pcl.LocalVariable, *pcl.Resource,
        *pcl.ReadResource, *pcl.Component, *pcl.OutputVariable,
        *pcl.PulumiBlock, *pcl.Hook:
    default:
        return fmt.Errorf("unsupported node %T", node)
    }
}

Type guard

func isSupportedNode(n pcl.Node) bool {
    switch n.(type) {
    case *pcl.ConfigVariable, *pcl.LocalVariable, *pcl.Resource,
        *pcl.ReadResource, *pcl.Component, *pcl.OutputVariable,
        *pcl.PulumiBlock, *pcl.Hook:
        return true
    default:
        return false
    }
}

Try / catch

if err := interp.Run(ctx, program); err != nil {
    if strings.HasPrefix(err.Error(), "unknown node type: ") {
        return fmt.Errorf("program uses a construct unsupported by this interpreter: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: A pcl.Node implementation newer than the interpreter's switch is fed into Interpreter.Run (e.g. a newly added node kind in pkg/pcl like Invoke or Import not handled by this switch), or a custom/foreign Node implementation is injected into the program's node list.

Common situations: Upgrading Pulumi sources so programs bind to new node types while using an older interpreter; using the interpreter library programmatically and constructing a custom pcl.Node; PCL features (e.g. imports/invoke nodes) not yet supported by the runtime interpreter.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/a2e4eb1fbca45707. Report an issue: GitHub.

Appendix: source

Thrown at pkg/pcl/runtime/interpreter.go:697

				return fmt.Errorf("failed to read resource %s: %w", node.Name(), err)
			}
		case *pcl.Component:
			if err := i.registerComponent(ctx, node); err != nil {
				return fmt.Errorf("failed to register component %s: %w", node.Name(), err)
			}
		case *pcl.OutputVariable:
			value, poison, diags := i.evalContext.Evaluate(node.Value)
			if poison != nil {
				return nil
			}
			if diags.HasErrors() {
				return diags
			}
			outputsLock.Lock()
			outputs[resource.PropertyKey(node.LogicalName())] = value
			outputsLock.Unlock()
		default:
			return fmt.Errorf("unknown node type: %T", node)
		}
		return nil
	}, pdag.MaxProcs(int(i.info.Parallel)))
	if err != nil {
		return nil, err
	}

	return outputs, nil
}

func (i *Interpreter) lookupResource(ctx context.Context, token string) (*schema.Resource, error) {
	pkg, mod, typ, diags := pcl.DecomposeToken(token, hcl.Range{})
	contract.Assertf(!diags.HasErrors(), "invalid token format for resource token %s", token)

	token = fmt.Sprintf("%s:%s:%s", pkg, mod, typ)
	pkgName := pkg
	if pkg == "pulumi" && mod == "providers" {
		pkgName = typ

View on GitHub (pinned to 793f7b2e16)