Skip to content

Internal compiler error: An unhandled panic occurred in the Encore compiler: unknown builtin type Error #2189

@sacenox

Description

@sacenox

The error output:

❯ encore test ./...

── Internal compiler error ────────────────────────────────────────────────────────────────[E0001]──

An unhandled panic occurred in the Encore compiler: unknown builtin type Error

This is a bug in Encore and should not have occurred. Please report this issue to the Encore team
either on Github at https://github.com/encoredev/encore/issues/new and include this error.

╭─[Stack Trace]
├─▶ v2builder.BuilderImpl.Parse.func1.1 encr.dev/v2/v2builder/v2builder.go:51
├─▶ legacymeta.(*builder).builtinType   encr.dev/v2/app/legacymeta/schema.go:61
├─▶ legacymeta.(*builder).schemaType    encr.dev/v2/app/legacymeta/schema.go:72
├─▶ legacymeta.(*builder).schemaType    encr.dev/v2/app/legacymeta/schema.go:130
├─▶ legacymeta.(*builder).structField   encr.dev/v2/app/legacymeta/schema.go:163
├─▶ legacymeta.(*builder).schemaType    encr.dev/v2/app/legacymeta/schema.go:92
╰─[... remaining frames omitted ...]

Versions:

❯ encore version
encore version v1.52.3
❯ go version
go version go1.25.1 darwin/arm64

Environment:

MacOS Sequoia 15.6.1 (Apple M4)

Details

I was able to find the code change that caused this on our end:

type Redacted struct {
	Error        *error  `json:"error,omitempty"`
	(more stuff here)
}

type RedactedCollection struct {
	Results []Redacted
}

RedactedCollection is a return type for a private encore endpoint. Changing the error pointer to a string pointer bypasses the error.

Steps to reproduce:

  • Create a private encore endpoint that returns a struct with a member representing an array of structs, which have a member that is a pointer to an error. Example using the structs represented above (roughly, sorry about all the redaction):
//encore:api private
func (n *RedactedServiceName) RedactedEndpointName(ctx context.Context, req RedactedResquest) (*RedactedCollection, error) { ... }
  • Add a test that invokes this private endpoint.
  • Observe the compiler error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions