BoundaryML/baml · error

%s

Error message

%s

What it means

The FFI InvocationResponse carried an InvocationResponse_Error variant; the message is the raw error text from the CFFI layer (formatted with %s). This wraps any native-side failure that occurred while creating or invoking a BAML raw object, surfacing the underlying runtime error message verbatim.

Source

Thrown at engine/language_client_go/baml_go/raw_objects/utils.go:210

	if err != nil {
		return nil, fmt.Errorf("failed to decode object response: %w", err)
	}

	return parsed, nil
}

type nilObject struct {
	any
}

func decodeObjectResponse(rt unsafe.Pointer, response *cffi.InvocationResponse) (any, error) {
	if response == nil {
		return nil, fmt.Errorf("nil response")
	}

	switch response.GetResponse().(type) {
	case *cffi.InvocationResponse_Error:
		return nil, fmt.Errorf("%s", response.GetError())
	case *cffi.InvocationResponse_Success:
		success := response.GetSuccess()
		switch success.Result.(type) {
		case *cffi.InvocationResponseSuccess_Object:
			object := success.GetObject()
			return decodeRawObject(rt, object)
		case *cffi.InvocationResponseSuccess_Objects:
			objects := success.GetObjects()
			parsed := make([]RawPointer, len(objects.Objects))
			for i, obj := range objects.Objects {
				decoded, err := decodeRawObject(rt, obj)
				if err != nil {
					return nil, fmt.Errorf("failed to decode object at index %d: %w", i, err)
				}
				parsed[i] = decoded
			}
			return parsed, nil
		case *cffi.InvocationResponseSuccess_Value:

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Read the wrapped message text — it names the actual native error
  2. Verify the function/class name passed to NewRawObject/CallMethod exists in your BAML schema
  3. Regenerate baml_client so generated code matches the installed runtime version
  4. Fix the underlying cause reported by the native error (bad args, missing function, etc.)

Example fix

// before
obj, err := baml.NewRawObject(rt, "Classifiy", args) // typo
// after
obj, err := baml.NewRawObject(rt, "Classify", args)
Defensive patterns

Strategy: try-catch

Validate before calling

if !strings.Contains(schemaText, funcOrClassName) { return fmt.Errorf("%q not defined in BAML schema", funcOrClassName) }

Try / catch

obj, err := baml.NewRawObject(rt, name, args)
if err != nil {
  log.Printf("baml native error for %s: %v", name, err)
  return err
}

Prevention

When it happens

Trigger: NewRawObject or CallMethod where the native runtime responds with *cffi.InvocationResponse_Error — e.g. the requested class/function does not exist or the native call failed.

Common situations: Referencing a BAML function/class name that does not exist in the loaded baml_client, version mismatch between generated client and runtime, or native-side argument errors.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/7c7babd68ca14cec. Report an issue: GitHub.