Skip to content

An unexpected error has occurred #134

@cpendery

Description

@cpendery

I'm trying to load a sample pkl file using the following code. I'm on go 1.24.2. I get back this error on Windows, but it succeeds on WSL. The versions are Pkl 0.28.1 (Linux 5.15.0-1064-aws, native) & Pkl 0.28.1 (Windows 10.0, native) & github.com/apple/pkl-go v0.10.0

go run main.go 
panic: org.pkl.core.PklBugException: An unexpected error has occurred. Would you mind filing a bug report?

Input: foo.pkl

keys {
    ["g"] {
        url = "https://google.com"
        keys {
            ["apple"] {
                url = "https://google.com/search?q=apple"
            }
        }
    }
}

Program: main.go

package main

import (
	"context"
	"fmt"

	"github.com/apple/pkl-go/pkl"
)

type Query struct {
	Url  *string            `pkl:"url"`
	Keys *map[string]*Query `pkl:"keys"`
}

type QueryConfig struct {
	Keys map[string]*Query `pkl:"keys"`
}

func main() {
	evaluator, err := pkl.NewEvaluator(context.Background(), pkl.PreconfiguredOptions)
	if err != nil {
		panic(err)
	}
	defer evaluator.Close()
	var cfg QueryConfig
	if err = evaluator.EvaluateModule(context.Background(), pkl.FileSource("foo.pkl"), &cfg); err != nil {
		panic(err)
	}
	fmt.Printf("Got module: %+v", cfg)
}

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