Skip to content

Fix KeyError crashes: TMDB API deprecated 'casts' field, replaced by 'credits' - #260

Merged
rmrector merged 1 commit into
xbmc:masterfrom
jszalek:fix/tmdb-api-casts-to-credits
Jun 28, 2026
Merged

rmrector merged 1 commit into
xbmc:masterfrom
jszalek:fix/tmdb-api-casts-to-credits

Conversation

@jszalek

@jszalek jszalek commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #259

What changed

  • append_to_response now requests credits instead of casts (TMDB API change)
  • Falls back to casts key for any backward compatibility edge cases
  • _gather_details: only overwrites movie['images'] with the language-fallback if it is non-empty (TMDB returns images: {} when no language is specified)
  • _assemble_details: uses .get() with safe defaults on keywords and releases
  • _parse_artwork: uses .get() with safe defaults on image sub-keys (posters, backdrops, logos)

Why

The TMDB API silently dropped casts from append_to_response responses in favour of credits, causing KeyError crashes during library scans. The empty images dict issue compounds this when the language-fallback request returns no images.

The TMDB API replaced 'casts' with 'credits' in append_to_response,
and returns an empty 'images' dict when no language is specified.
This caused KeyError crashes on 'casts', 'keywords', and 'images'
during library scans.

- Request 'credits' instead of 'casts' in append_to_response
- Fall back to 'casts' key for backward compatibility
- Only overwrite movie images if fallback images are non-empty
- Use .get() with defaults on 'keywords', 'releases', and image sub-keys
@kodiai

kodiai Bot commented Jun 27, 2026 •

Copy link
Copy Markdown

Decision: APPROVE

Issues: none

Evidence:

  • Review prompt covered 1 changed file.
Review Details
  • Files reviewed: 1

  • Findings: 0 critical, 0 major, 0 medium, 0 minor

  • Lines changed: +19 -17

  • Profile: strict (auto, lines changed: 36)

  • Contributor experience: coarse-fallback (using coarse fallback signals only)

  • Review completed: 2026-06-27T18:42:10.427Z

  • Total wall-clock: 5m 10s

  • Phase timings:

    • queue wait: 0ms
    • workspace preparation: 1.4s
    • retrieval/context assembly: 3.4s
    • executor handoff: 9.1s
    • remote runtime: 4m 51s
    • publication: 2.3s
  • Tokens: 60 in / 13,503 out | 0.3700

  • Keyword parsing: No keywords detected

  • Budget behavior: complete (within-budget).

  • Prompt budget: 5 sections, 0 trimmed, 0 bypassed, 0 trimmed tokens.

  • Cache behavior: 2 observations, 1 hits, 1 misses, 0 degraded, 0 bypassed.

  • Continuation behavior: 0 observations, 0 compacted, 0 fallback, 0 degraded, 0 bypassed.

@rmrector
rmrector merged commit f22705a into xbmc:master Jun 28, 2026
2 checks passed
@rmrector

Copy link
Copy Markdown
Contributor

thanks for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError crashes during library scan: TMDB API deprecated 'casts' field

2 participants