---
id: t2
title: add some error handlers
status: Done
created: 2026-04-17
assignee: opencode
priority: P1
---

check for error handlers and good quality code so the app never crashes.

## What was done

Added comprehensive error guards across the codebase to prevent crashes from malformed data:

### serializer.ts
- `serializeTaskFile()`: Added guards for frontmatter being a valid object, type checking for frontmatter values, multiline report preservation, and null coalescing for body

### parser.ts
- `parseSimpleYaml()`: Added early return for falsy/invalid input, guards for `m[2]` and regex match access, safe array mapping
- `buildColumnsFromTasks()`: Added fallback handling for missing statuses and unknown columns
- `parseTaskFile()`: Added early return guard for empty input
- `extractSubtasks()`: Added guards for body being a valid string, all line accesses, regex match groups, and text extraction
- `injectSubtasks()`: Added nullish guards on lines array access, safe array slicing bounds, null coalescing for line content

These changes ensure the app handles corrupted, incomplete, or malformed markdown files gracefully without crashing.

## Subtasks

- [x] check the code for errors
- [x] add some error handlers to avoid crashes
- [x] document that
