{"record":{"id":"bf155895a6668e56","repo":"chenhg5/cc-connect","slug":"s-image-batch-window-ms-must-be-0-got-d","errorCode":null,"errorMessage":"%s: image_batch_window_ms must be >= 0, got %d","messagePattern":"(.+?): image_batch_window_ms must be >= 0, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":425,"sourceCode":"\t\tcase \"compact\", \"card\":\n\t\t\tprogressStyle = strings.ToLower(strings.TrimSpace(v))\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"%s: invalid progress_style %q (want legacy, compact, or card)\", name, v)\n\t\t}\n\t}\n\tuseInteractiveCard := true\n\tif v, ok := opts[\"enable_feishu_card\"].(bool); ok {\n\t\tuseInteractiveCard = v\n\t}\n\n\timageBatchWindow := defaultImageBatchWindow\n\tif raw, ok := opts[\"image_batch_window_ms\"]; ok {\n\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}","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L407-L443","documentation":"Range check in newPlatform: a successfully coerced image_batch_window_ms that is negative is rejected, since a negative coalescing window is meaningless. Note that 0 is allowed (disables batching delay).","triggerScenarios":"image_batch_window_ms = -100 (or any negative number) in the feishu platform options.","commonSituations":"Users attempting to 'disable' batching with a negative value; arithmetic in templated configs producing negatives.","solutions":["Set image_batch_window_ms to 0 or a positive integer.","Use 0 if you want minimal/no batching delay; remove the key for the default window."],"exampleFix":"// before (config.toml)\nimage_batch_window_ms = -100\n// after\nimage_batch_window_ms = 0","handlingStrategy":"validation","validationCode":"if ms < 0 {\n    log.Fatalf(\"image_batch_window_ms must be >= 0, got %d\", ms)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 0 to disable the delay, never a negative number.","Document that 0 is the valid 'off' value in your config template."],"tags":["feishu","config","range-check"],"backgroundTag":"value-out-of-range","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"}