Commit 2ec60f6
fix: Handle YAML parsing errors gracefully in update_frontmatter (#378)
The update_frontmatter() function was logging ERROR (level 17) for malformed
YAML frontmatter instead of handling it gracefully. This caused 1,112+ errors
per 3 hours in production from files with titles like "KB: Something" where
the colon breaks YAML parsing.
This fix applies the same error handling pattern from PR #368's entity_parser.py:
- Catch ParseError and yaml.YAMLError when parsing frontmatter
- Log as WARNING (level 13) instead of ERROR
- Treat file as having no frontmatter and proceed with update
- Only log ERROR for actual file operation failures
Files with malformed frontmatter now get updated successfully with valid
frontmatter instead of spamming error logs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>1 parent e6c8e36 commit 2ec60f6
2 files changed
Lines changed: 50 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
218 | 227 | | |
219 | 228 | | |
220 | 229 | | |
| |||
229 | 238 | | |
230 | 239 | | |
231 | 240 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
237 | 248 | | |
238 | 249 | | |
239 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
262 | 293 | | |
263 | 294 | | |
264 | 295 | | |
| |||
0 commit comments