{"record":{"id":"8e069d6b5f800321","repo":"chenhg5/cc-connect","slug":"s-invalid-resource-chunk-size-bytes-v-w","errorCode":null,"errorMessage":"%s: invalid resource_chunk_size_bytes %v: %w","messagePattern":"(.+?): invalid resource_chunk_size_bytes (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":438,"sourceCode":"\t\tms, err := coerceMilliseconds(raw)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s: invalid image_batch_window_ms %v: %w\", name, raw, err)\n\t\t}\n\t\tif ms < 0 {\n\t\t\treturn nil, fmt.Errorf(\"%s: image_batch_window_ms must be >= 0, got %d\", name, ms)\n\t\t}\n\t\timageBatchWindow = time.Duration(ms) * time.Millisecond\n\t}\n\n\t// resource_chunk_size_bytes: byte size for each Range request when chunked-\n\t// downloading Feishu message resources (issue #1741). The larkim SDK does\n\t// not expose Range headers, so for resources above ~2 MiB a plain GET\n\t// returns code=234037. Default 8 MiB; clamped to [1 MiB, 64 MiB].\n\tresourceChunkSize := int64(8 * 1024 * 1024)\n\tif raw, ok := opts[\"resource_chunk_size_bytes\"]; ok {\n\t\tn, err := coerceMilliseconds(raw)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s: invalid resource_chunk_size_bytes %v: %w\", name, raw, err)\n\t\t}\n\t\tif n > 0 {\n\t\t\tresourceChunkSize = n\n\t\t}\n\t}\n\tif resourceChunkSize < 1*1024*1024 {\n\t\tresourceChunkSize = 1 * 1024 * 1024\n\t}\n\tif resourceChunkSize > 64*1024*1024 {\n\t\tresourceChunkSize = 64 * 1024 * 1024\n\t}\n\n\t// Webhook mode configuration (for Lark international version)\n\tport, _ := opts[\"port\"].(string)\n\tif port == \"\" {\n\t\tport = \"8080\"\n\t}\n\tcallbackPath, _ := opts[\"callback_path\"].(string)","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L420-L456","documentation":"resource_chunk_size_bytes must be coercible to a number via coerceMilliseconds (shared numeric helper); non-numeric values abort newPlatform with this wrapped error. A valid number below 1 MiB is silently clamped instead of erroring.","triggerScenarios":"resource_chunk_size_bytes = \"8MiB\" (string with unit), true, or a table in feishu platform options.","commonSituations":"Human-readable byte strings like \"8MiB\" or \"8388608 bytes\"; users assuming unit suffixes are parsed.","solutions":["Provide a plain integer byte count: resource_chunk_size_bytes = 8388608.","Remove the option to use the 8 MiB default.","Note values < 1 MiB are clamped up, not rejected — only non-numeric types error."],"exampleFix":"// before (config.toml)\nresource_chunk_size_bytes = \"8MiB\"\n// after\nresource_chunk_size_bytes = 8388608","handlingStrategy":"validation","validationCode":"if raw, ok := opts[\"resource_chunk_size_bytes\"]; ok {\n    switch raw.(type) {\n    case int, int64, float32, float64:\n    default:\n        log.Fatalf(\"resource_chunk_size_bytes must be a plain byte count, got %T\", raw)\n    }\n}","typeGuard":"func isNumber(v any) bool { switch v.(type) { case int, int64, float32, float64: return true }; return false }","tryCatchPattern":null,"preventionTips":["Use integer byte counts (8388608), not \"8MiB\" strings.","Omit the option to keep the 8 MiB default."],"tags":["feishu","config","type-mismatch"],"backgroundTag":"invalid-config-value","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"}