{"record":{"id":"00bcd6bb72a1b96e","repo":"fish2018/pansou","slug":"s-00bcd6","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/miosou/miosou.go","lineNumber":340,"sourceCode":"\tvar data strings.Builder\n\tvar streamErr error\n\tflush := func() {\n\t\tif data.Len() == 0 {\n\t\t\treturn\n\t\t}\n\t\tif event == \"snapshot\" || event == \"\" {\n\t\t\tvar snapshot searchSnapshot\n\t\t\tif json.Unmarshal([]byte(data.String()), &snapshot) == nil {\n\t\t\t\tfor cloud, items := range snapshot.MergedByType {\n\t\t\t\t\tgroups[cloud] = mergeItems(groups[cloud], items)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if event == \"error\" {\n\t\t\tvar payload struct {\n\t\t\t\tMessage string `json:\"message\"`\n\t\t\t}\n\t\t\tif json.Unmarshal([]byte(data.String()), &payload) == nil && payload.Message != \"\" {\n\t\t\t\tstreamErr = fmt.Errorf(\"%s\", payload.Message)\n\t\t\t} else {\n\t\t\t\tstreamErr = fmt.Errorf(\"%s\", strings.TrimSpace(data.String()))\n\t\t\t}\n\t\t}\n\t\tevent = \"\"\n\t\tdata.Reset()\n\t}\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif line == \"\" {\n\t\t\tflush()\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(line, \"event:\") {\n\t\t\tevent = strings.TrimSpace(strings.TrimPrefix(line, \"event:\"))\n\t\t} else if strings.HasPrefix(line, \"data:\") {\n\t\t\tif data.Len() > 0 {\n\t\t\t\tdata.WriteByte('\\n')","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/miosou/miosou.go#L322-L358","documentation":"The miosou plugin records an upstream streaming error event. When an SSE event named \"error\" arrives, it tries to parse the event data as JSON and use its \"message\" field; if that fails, it uses the raw event text. This is a wrapped relay of whatever error message the upstream AI/streaming service sent, not a bug in the plugin itself.","triggerScenarios":"Upstream stream emits an SSE event with event==\"error\"; occurs on upstream auth failures, model errors, quota exhaustion, or mid-stream provider outages.","commonSituations":"Expired or invalid upstream API key, upstream rate limiting, provider returning an error mid-generation, or a proxy/gateway returning HTML that is passed through as raw text.","solutions":["Read the wrapped message text to see the actual upstream error and fix the root cause (key, quota, model name).","Verify the upstream account credentials and quota for the miosou provider.","Retry the request; transient upstream errors often resolve on retry.","Check whether the upstream endpoint changed its SSE error payload format."],"exampleFix":"// before\nstreamErr = fmt.Errorf(\"%s\", payload.Message)\n// after\nif payload.Message == \"\" {\n    payload.Message = \"unknown upstream stream error\"\n}\nstreamErr = fmt.Errorf(\"miosou upstream: %s\", payload.Message)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"results, err := pluginSearch(ctx, query)\nif err != nil {\n    log.Printf(\"miosou upstream error: %v\", err)\n    // fall back to another provider or surface message to user\n    return fallbackProvider(ctx, query)\n}","preventionTips":["Keep upstream API keys and quotas valid to avoid provider-side error events.","Monitor upstream provider status pages.","Implement provider fallback for streaming searches."],"tags":["streaming","upstream","sse"],"backgroundTag":"upstream-api-error","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}