βοΈ Operational & Debugging Guide
1. Activating a New Batch
To run a new course material generation batch without using the UI:
- Prepare a configuration file (Preset) or use an existing one.
- Insert a record into the
task_batchestable:
INSERT INTO task_batches (name, preset_key, status, total_tasks, config)
VALUES ('Test Batch Manual', 'syllabus_gen_v1', 'pending', 1, '{"input_file": "..."}');Note: The [Base] Load Batch workflow will automatically scan and process this record.
2. Checking Status
To view progress:
-- View batch overview
SELECT name, status, completed_tasks, failed_tasks FROM task_batches;
-- View failed tasks
SELECT id, error_message FROM ai_tasks WHERE status = 'failed';
-- View stuck tasks (processing for too long)
SELECT id, started_at FROM ai_tasks
WHERE status = 'processing'
AND started_at < NOW() - INTERVAL '30 minutes';3. Troubleshooting
Issue: Task stuck in status: 'plan' indefinitely
- Cause:
- The
[Base] Base Agentn8n workflow is inactive. - No API Keys are available (quota exceeded, all keys blocked).
- The
- Resolution:
- Verify in the n8n UI that the workflow is Active.
- Check the
api_key_healthtable.
Issue: Task failed with a JSON Parse error
- Cause: AI returned malformed Markdown or non-standard JSON formatting.
- Resolution:
- Review the
error_messagein theai_taskstable. - Adjust the Prompt Template to instruct the AI more clearly for standard JSON.
- Reset the status to
planto retry:
UPDATE ai_tasks SET status = 'plan', retry_count = 0 WHERE id = '<task_id>'; - Review the
Issue: Child tasks not created (Data loss)
- Cause: Error in Phase 5 (Prepare Next Tasks), typically due to incorrect
next_stage_configor missinggrt. - Resolution: Examine the
extrafield of the parent task for validgrtentries.
4. Periodic Maintenance
- Purge Old Logs: The
api_key_usage_logtable can grow rapidly. Periodically clean up logs older than 30 days. - Database Vacuum: Run
VACUUM ANALYZEon large tables likeai_tasks.
Last updated on