Don't crash planning when the LLM returns a non-object palette

Closed
#37 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@jay23606 is already working on this.

Since Nov 6, 2026.

  • #41 by @jay23606 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start with easyedit/plan.py:50-53 and inspect how make_plan() merges the palette and handles montage_queries. Add or run the unit test described in the issue, stubbing ask_json with string and list palettes and invalid hex values; done means invalid palette parts use defaults and non-string montage query items are handled safely. An open linked pull request (#41) is already addressing this issue.

Written by the indexing model from the issue text.

Description

bug good first issue

llm.py promises that a bad reply "degrades quality instead of breaking the pipeline", but make_plan() trusts the shape of palette. If the model answers "palette": "gold and black" (or a list), {**DEFAULT_PALETTE, **(reply.get("palette") or {})} raises TypeError: 'str' object is not a mapping, and the whole run dies before any download. Checked with ask_json stubbed to return {"speech_query": "x", "palette": "gold and black"}.

The individual colours aren't checked either. They go into edit.js, and template/film.js:11 uses them as CSS colours, so a value like "red-ish" renders as no colour.

Task: merge palette only if it is a dict, and keep only the four known keys whose values match ^#[0-9a-fA-F]{6}$. Fall back to DEFAULT_PALETTE for everything else. Do the same type check for montage_queries items (strings only).

Where: easyedit/plan.py:50-53.

Done when: a unit test that stubs ask_json shows that a string palette, a list palette, and a palette with a bad hex all produce a plan whose palette uses the defaults for the bad parts.


Getting started: Python 3.10+, Node 22+, FFmpeg on PATH. npm install, pip install -r requirements.txt, then python -m easyedit.doctor. Run python -m unittest discover before opening a PR. Passing --llm none skips the model entirely, which is the fastest way to test. Comment here to claim it. Questions → Discord.

Dominant language
Python
Stars
168
Forks
24
Avg merge
2d 10h
Merged PRs (30d)
14

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from blixvip/easyedit

All issues in blixvip/easyedit

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.