{"record":{"id":"3c2f9baf3a466eef","repo":"router-for-me/CLIProxyAPI","slug":"model-execution-failed","errorCode":null,"errorMessage":"model execution failed","messagePattern":"model execution failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/host_callbacks.go","lineNumber":319,"sourceCode":"\t\tHeaders:                 cloneHeader(req.Headers),\n\t\tQuery:                   cloneValues(req.Query),\n\t\tAlt:                     req.Alt,\n\t\tSkipInterceptorPluginID: skipPluginID,\n\t\tSkipRouterPluginID:      skipPluginID,\n\t}\n}\n\nfunc modelExecutionError(errMsg *interfaces.ErrorMessage) error {\n\tif errMsg == nil {\n\t\treturn nil\n\t}\n\tif errMsg.Error != nil {\n\t\treturn errMsg.Error\n\t}\n\tif errMsg.StatusCode > 0 {\n\t\treturn fmt.Errorf(\"model execution failed with status %d\", errMsg.StatusCode)\n\t}\n\treturn fmt.Errorf(\"model execution failed\")\n}\n\nfunc (h *Host) callHostLog(ctx context.Context, request []byte) ([]byte, error) {\n\tvar req rpcHostLogRequest\n\tif errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {\n\t\treturn nil, fmt.Errorf(\"decode host log request: %w\", errUnmarshal)\n\t}\n\tctx = h.resolveCallbackContext(req.HostCallbackID, ctx)\n\tmessage := strings.TrimSpace(req.Message)\n\tif message == \"\" {\n\t\tmessage = \"plugin log\"\n\t}\n\tfields := log.Fields{}\n\tfor key, value := range req.Fields {\n\t\tkey = strings.TrimSpace(key)\n\t\tif key != \"\" {\n\t\t\tfields[key] = value\n\t\t}","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/host_callbacks.go#L301-L337","documentation":"The catch-all branch of modelExecutionError: the executor returned a non-nil ErrorMessage with neither an Error object nor a positive status code. The nested model call failed, but the executor gave no structured detail, so the host can only report generic failure to the plugin.","triggerScenarios":"host.model.execute returning an ErrorMessage with all fields zero: an executor implementation bug, an aborted/canceled execution reported without status, or an internal path that builds ErrorMessage{} without filling cause or code.","commonSituations":"Custom executor plugins that signal failure with an empty ErrorMessage; race where execution is canceled mid-flight and the error is assembled incompletely; version skew between executor interface expectations.","solutions":["Enable debug logging around the nested call to see which executor produced the empty ErrorMessage.","If you own the executor/plugin code, always set either Error or StatusCode on failures instead of an empty ErrorMessage.","Retry once to rule out a transient canceled execution; if reproducible, inspect the executor's failure paths.","Update executor plugin and host to matching versions."],"exampleFix":"// executor/plugin side, before\nreturn resp, interfaces.ErrorMessage{} // failure with no detail\n\n// after\nreturn resp, interfaces.ErrorMessage{StatusCode: http.StatusBadGateway, Error: fmt.Errorf(\"upstream call failed\")}","handlingStrategy":"retry","validationCode":null,"typeGuard":"func detailedModelError(errMsg *interfaces.ErrorMessage) bool {\n    return errMsg != nil && (errMsg.Error != nil || errMsg.StatusCode > 0)\n}","tryCatchPattern":"resp, err := host.ModelExecute(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"model execution failed\") && !strings.Contains(err.Error(), \"status\") {\n    // detail-less failure: single retry to rule out a transient abort, then report upstream\n    return retryOnceThenReport(ctx, req, err)\n}","preventionTips":["Executor implementations should always populate Error or StatusCode on failure.","Log the request context when this occurs to identify which executor produced the empty ErrorMessage."],"tags":["plugin","host-callback","upstream","error-handling","pluginhost"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}