{"record":{"id":"376c3def8b3e3d82","repo":"BoundaryML/baml","slug":"failed-to-get-is-url-w","errorCode":null,"errorMessage":"failed to get is url: %w","messagePattern":"failed to get is url: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_media.go","lineNumber":104,"sourceCode":"\t\treturn nil, fmt.Errorf(\"failed to get mime type: %w\", err)\n\t}\n\n\tif result == nil {\n\t\treturn nil, nil\n\t}\n\n\tas_mime_type, ok := result.(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected type for mime type: %T\", result)\n\t}\n\n\treturn &as_mime_type, nil\n}\n\nfunc (m *mediaHolder) IsUrl() (bool, error) {\n\tresult, err := raw_objects.CallMethod(m, \"is_url\", nil)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to get is url: %w\", err)\n\t}\n\n\treturn result.(bool), nil\n}\n\nfunc (m *mediaHolder) IsBase64() (bool, error) {\n\tresult, err := raw_objects.CallMethod(m, \"is_base64\", nil)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to get is base64: %w\", err)\n\t}\n\n\treturn result.(bool), nil\n}\n\nfunc (m *mediaHolder) AsUrl() (*string, error) {\n\tresult, err := raw_objects.CallMethod(m, \"as_url\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get as url: %w\", err)","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_media.go#L86-L122","documentation":"Wraps any error from the FFI call to the runtime's `is_url` method on a media object. IsUrl() asks the BAML runtime whether the media content is a URL; if that remote method call fails, the error is wrapped with this message and the cause preserved via %w.","triggerScenarios":"Calling IsUrl() on an Image/Audio/PDF/Video whose raw object handle is invalid, freed, or whose runtime `is_url` invocation errors.","commonSituations":"Reusing a media object after its backing response was garbage-collected or released; Go client / native runtime version skew; runtime-side failure converting the stored media.","solutions":["Inspect errors.Unwrap(err) for the underlying FFI failure","Recreate the media object from a fresh BAML response instead of a stale handle","Align Go module and native runtime versions","Check that the object was constructed through the public BAML API (not manually)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if media == nil { return fmt.Errorf(\"media object is nil\") }","typeGuard":null,"tryCatchPattern":"isUrl, err := media.IsUrl()\nif err != nil {\n    log.Printf(\"is_url failed: %v\", errors.Unwrap(err))\n    isUrl = false\n}","preventionTips":["Do not reuse media handles after the parent response is released","Keep client and runtime versions aligned","Rebuild media objects from fresh BAML responses rather than caching"],"tags":["go","ffi","baml","media"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}