{"record":{"id":"a3508cb20ccce396","repo":"zed-industries/zed","slug":"error-locating-fragment-function","errorCode":null,"errorMessage":"error locating fragment function","messagePattern":"error locating fragment function","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_apple/src/metal_renderer.rs","lineNumber":1289,"sourceCode":"    }\n\n    RgbaImage::from_raw(width, height, pixels).context(\"failed to create RgbaImage from pixel data\")\n}\n\nfn build_pipeline_state(\n    device: &metal::DeviceRef,\n    library: &metal::LibraryRef,\n    label: &str,\n    vertex_fn_name: &str,\n    fragment_fn_name: &str,\n    pixel_format: metal::MTLPixelFormat,\n) -> metal::RenderPipelineState {\n    let vertex_fn = library\n        .get_function(vertex_fn_name, None)\n        .expect(\"error locating vertex function\");\n    let fragment_fn = library\n        .get_function(fragment_fn_name, None)\n        .expect(\"error locating fragment function\");\n\n    let descriptor = metal::RenderPipelineDescriptor::new();\n    descriptor.set_label(label);\n    descriptor.set_vertex_function(Some(vertex_fn.as_ref()));\n    descriptor.set_fragment_function(Some(fragment_fn.as_ref()));\n    let color_attachment = descriptor.color_attachments().object_at(0).unwrap();\n    color_attachment.set_pixel_format(pixel_format);\n    color_attachment.set_blending_enabled(true);\n    color_attachment.set_rgb_blend_operation(metal::MTLBlendOperation::Add);\n    color_attachment.set_alpha_blend_operation(metal::MTLBlendOperation::Add);\n    color_attachment.set_source_rgb_blend_factor(metal::MTLBlendFactor::SourceAlpha);\n    color_attachment.set_source_alpha_blend_factor(metal::MTLBlendFactor::One);\n    color_attachment.set_destination_rgb_blend_factor(metal::MTLBlendFactor::OneMinusSourceAlpha);\n    color_attachment.set_destination_alpha_blend_factor(metal::MTLBlendFactor::One);\n\n    device\n        .new_render_pipeline_state(&descriptor)\n        .expect(\"could not create render pipeline state\")","sourceCodeStart":1271,"sourceCodeEnd":1307,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_apple/src/metal_renderer.rs#L1271-L1307","documentation":"Same as the vertex-function lookup but for the fragment shader function: library.get_function returned None. Indicates the Metal library doesn't contain the expected fragment entry point — mismatched or outdated shader artifacts.","triggerScenarios":"Thrown at crates/gpui_apple/src/metal_renderer.rs:1282 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify fragment_fn_name exists in the compiled library","Rebuild shaders together with the renderer code","Inspect library.function_names() at runtime to diagnose mismatches"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}