Skip to content

fix: pagination error too many values to unpack - #11475

Merged
davidsbatista merged 12 commits into
mainfrom
fix/pag-error-too-many-values-to-unpack
Jun 2, 2026
Merged

fix: pagination error too many values to unpack#11475
davidsbatista merged 12 commits into
mainfrom
fix/pag-error-too-many-values-to-unpack

Conversation

@davidsbatista

@davidsbatista davidsbatista commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary:

Closes #11449

Proposed Changes:

expand_page_range() in haystack/utils/misc.py crashes with ValueError: too many values to unpack (expected 2) when any element of the input list contains more than one hyphen, e.g. "5-10-15".

How did you test it?

  • unit tests

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

devteamaegis and others added 7 commits May 31, 2026 18:59
expand_page_range() called page.split("-") without maxsplit, then
unpacked into exactly two variables. A range string like "5-10-15"
produced "too many values to unpack" instead of a useful error message.

Add maxsplit=1 and validate that both parts are digit strings before
expanding the range, raising a descriptive ValueError for malformed input.

Fixes #11449
@davidsbatista
davidsbatista requested a review from a team as a code owner June 2, 2026 07:07
@davidsbatista
davidsbatista requested review from sjrl and removed request for a team June 2, 2026 07:07
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haystack-docs Ignored Ignored Preview Jun 2, 2026 9:30am

Request Review

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/utils
  misc.py
Project Total  

This report was generated by python-coverage-comment-action

@claude

claude Bot commented Jun 2, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Comment thread haystack/utils/misc.py Outdated
Comment thread haystack/utils/misc.py Outdated
Comment thread releasenotes/notes/fix-page-value-error-39ef3fa0300e2479.yaml Outdated
Comment thread test/utils/test_misc.py
assert kwargs["keys"] == ["key1"]


class TestExpandPageRange:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh I didn't realize this is the first unit test we have for this function. Could we add a few more to cover standard use cases?

davidsbatista and others added 4 commits June 2, 2026 10:40
Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>

@sjrl sjrl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@davidsbatista
davidsbatista enabled auto-merge (squash) June 2, 2026 09:32
@davidsbatista
davidsbatista merged commit 1661601 into main Jun 2, 2026
26 checks passed
@davidsbatista
davidsbatista deleted the fix/pag-error-too-many-values-to-unpack branch June 2, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: expand_page_range() raises confusing ValueError for multi-hyphen range strings

3 participants