{"record":{"id":"d3ec9963eb1f8338","repo":"chenhg5/cc-connect","slug":"s-d3ec99","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/slack/slack.go","lineNumber":570,"sourceCode":"\t\tThreadTimestamp: rc.timestamp,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"slack: send file: %w\", err)\n\t}\n\treturn nil\n}\n\nvar _ core.FileSender = (*Platform)(nil)\n\nfunc (p *Platform) downloadSlackFile(url string) ([]byte, error) {\n\tif url == \"\" {\n\t\treturn nil, fmt.Errorf(\"empty URL\")\n\t}\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\treq.Header.Set(\"Authorization\", \"Bearer \"+p.botToken)\n\tresp, err := core.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s\", core.RedactToken(err.Error(), p.botToken))\n\t}\n\tdefer resp.Body.Close()\n\n\t// Check if we got an unexpected status code (e.g., redirect to login page)\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, _ := io.ReadAll(io.LimitReader(resp.Body, 1024))\n\t\treturn nil, fmt.Errorf(\"download failed with status %d: %s\", resp.StatusCode, string(body))\n\t}\n\n\tdata, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read response body: %w\", err)\n\t}\n\n\t// Basic sanity check: detect if we received HTML instead of binary data\n\tif len(data) > 0 && (bytes.HasPrefix(data, []byte(\"<!DOCTYPE\")) || bytes.HasPrefix(data, []byte(\"<html\"))) {\n\t\treturn nil, fmt.Errorf(\"received HTML response (likely missing auth); first 100 bytes: %s\", string(data[:min(100, len(data))]))\n\t}","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/slack/slack.go#L552-L588","documentation":"The authenticated GET of a Slack file URL failed at transport level. The error text is passed through with the bot token redacted via core.RedactToken before wrapping, since the raw error can echo request details.","triggerScenarios":"Thrown at platform/slack/slack.go:570 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry; check network/proxy access to files.slack.com"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}