microsoft/typescript-go · error

failed to encode type node: %w

Error message

failed to encode type node: %w

What it means

Error "failed to encode type node: %w" thrown in microsoft/typescript-go.

Source

Thrown at internal/api/session.go:2421

		return nil, err
	}

	var enclosingDeclaration *ast.Node
	if params.Location != "" {
		enclosingDeclaration, err = setup.sd.resolveNodeHandle(setup.program, params.Location)
		if err != nil {
			return nil, err
		}
	}

	typeNode := setup.checker.TypeToTypeNode(t, enclosingDeclaration, nodebuilder.Flags(params.Flags), nil)
	if typeNode == nil {
		return nil, nil
	}

	data, _, err := encoder.EncodeNode(typeNode.AsNode(), nil)
	if err != nil {
		return nil, fmt.Errorf("failed to encode type node: %w", err)
	}

	if s.useBinaryResponses {
		return RawBinary(data), nil
	}
	return &SourceFileResponse{
		Data: base64.StdEncoding.EncodeToString(data),
	}, nil
}

func (s *Session) handleSignatureToSignatureDeclaration(ctx context.Context, params *SignatureToSignatureDeclarationParams) (any, error) {
	setup, err := s.setupChecker(ctx, params.Snapshot, params.Project)
	if err != nil {
		return nil, err
	}
	defer setup.done()

	sig, err := setup.resolveSignatureHandle(params.Signature)

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/api/session.go:2421 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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