48-Hour Field Notes: The Free Model Returned Valid JSON, and My Schema Said Nothing
说明与用途
在48小时实验中发现免费LLM层返回空数组被视为有效。添加minItems:1并改进重试逻辑以及预检测试集可稳定 nightly‑job。
问题
A nightly extraction job using a free model tier returned empty arrays despite valid JSON, causing downstream reports to be empty.
结果
Adding minItems:1 to the schema prevented empty arrays from being considered valid, reducing false positives. Refined retry logic and a pre‑flight probe mitigated free tier unreliability, leading to a stable nightly extraction job.
工作流
- 1. Define JSON schema with minItems:1 for records array.
- 2. Run extraction job on free server with MonkeyCode free model.
- 3. Observe empty records and empty downstream report.
- 4. Add retry loop with backoff for transport failures.
- 5. Identify content failures and avoid retrying them.
- 6. Detect config errors (wrong model name) and stop run immediately.
- 7. Add pre‑flight probe with test cases for schema, ambiguous input, oversized input, wrong model name, idle window, and worker kill.
- 8. Verify probe passes before production run.
- 9. Deploy job with updated schema and retry logic.
证据
My JSON Schema said "records": {"type": "array"}. An empty array is a valid array.
The one-keyword fix is "minItems": 1, and it is the single highest-value line in the whole article.
A mistyped model name produced a 4xx on every request. My retry wrapper treated everything that was not a 200 as transient, so the job cheerfully backed off and retried for hours.
Mid-run, the worker process disappeared and the journal I had been appending to went with it. The extraction calls were fine. The host was ephemer…
- 记录日期: 2026-10-18T21:56:07.246Z