BoundaryML/baml · error

failed to get ID: %w

Error message

failed to get ID: %w

What it means

httpRequest.RequestId() invokes the underlying runtime object's 'id' method through the raw-objects bridge. The 'failed to get ID' wrapper means the bridge call itself failed before a value was returned — the runtime object could not execute its 'id' method.

Source

Thrown at engine/language_client_go/pkg/rawobjects_http_request.go:30

	*raw_objects.RawObject
}

func newHttpRequest(ptr int64, rt unsafe.Pointer) HTTPRequest {
	return &httpRequest{raw_objects.FromPointer(ptr, rt)}
}

func (h *httpRequest) ObjectType() cffi.BamlObjectType {
	return cffi.BamlObjectType_OBJECT_HTTP_REQUEST
}

func (h *httpRequest) pointer() int64 {
	return h.RawObject.Pointer()
}

func (h *httpRequest) RequestId() (string, error) {
	result, err := raw_objects.CallMethod(h, "id", nil)
	if err != nil {
		return "", fmt.Errorf("failed to get ID: %w", err)
	}

	id, ok := result.(string)
	if !ok {
		return "", fmt.Errorf("unexpected type for ID: %T", result)
	}

	return id, nil
}

func (h *httpRequest) Url() (string, error) {
	result, err := raw_objects.CallMethod(h, "url", nil)
	if err != nil {
		return "", fmt.Errorf("failed to get URL: %w", err)
	}

	url, ok := result.(string)
	if !ok {

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Ensure the httpRequest came from the library's dispatch/API pipeline, not manual construction
  2. Inspect the wrapped cause (%w) for the underlying bridge failure
  3. Verify the runtime/script version matches the Go client version
  4. Re-dispatch the request to obtain a fresh object
Defensive patterns

Strategy: try-catch

Validate before calling

if req == nil { return errors.New("request unavailable") }

Type guard

func (h *httpRequest) hasID() bool { return h != nil && h.RawObject != nil && h.RawObject.Pointer() != 0 }

Try / catch

id, err := req.RequestId()
if err != nil {
    return fmt.Errorf("request has no ID: %w", err)
}

Prevention

When it happens

Trigger: Calling RequestId() on an httpRequest whose backing raw object is invalid, detached, or lacks a working 'id' method; the runtime method raises an exception during execution.

Common situations: Reusing a request object after the script/runtime was torn down; building requests manually instead of through the library's dispatch pipeline; version drift where the runtime object no longer exposes 'id'.

Related errors


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