Skip to content

Fix AttributeError when job input dataset association has no dataset#28

Draft
Copilot wants to merge 2 commits into
devfrom
copilot/fix-attributeerror-none-type
Draft

Fix AttributeError when job input dataset association has no dataset#28
Copilot wants to merge 2 commits into
devfrom
copilot/fix-attributeerror-none-type

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 7, 2026

Optional/not-provided data inputs are recorded as None in JobToInputDatasetAssociation. The purged-input check in the job files API dereferences jtid.dataset.dataset.purged without guarding against this, causing:

AttributeError: 'NoneType' object has no attribute 'dataset'
  File "galaxy/webapps/galaxy/api/job_files.py", line 71, in <genexpr>
    if any(jtid.dataset.dataset.purged for jtid in job.input_datasets):

Add if jtid.dataset filter to the generator expression to skip null associations.

How to test the changes?

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. Run a tool with an optional data input left empty, then trigger the FileNotFoundError path in the job files API (e.g. by purging an unrelated input dataset while the job is running).

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • wheels.galaxyproject.org
    • Triggering command: /home/REDACTED/work/galaxy/galaxy/.venv/bin/python python -m pip install -r requirements.txt -r ./lib/galaxy/dependencies/dev-requirements.txt --extra-index-url REDACTED (dns block)
    • Triggering command: /home/REDACTED/work/galaxy/galaxy/.venv/bin/python /home/REDACTED/work/galaxy/galaxy/.venv/bin/python /home/REDACTED/work/galaxy/galaxy/.venv/lib/python3.12/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-h4t9ifzm/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED --extra-index-url REDACTED -- setuptools&gt;=64 setuptools-scm&gt;=8 (dns block)
    • Triggering command: /home/REDACTED/work/galaxy/galaxy/.venv/bin/python /home/REDACTED/work/galaxy/galaxy/.venv/bin/python /home/REDACTED/work/galaxy/galaxy/.venv/lib/python3.12/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-tolnbq59/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED --extra-index-url REDACTED -- setuptools&gt;=40.8.0 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@mvdbeek
Copy link
Copy Markdown
Owner

mvdbeek commented Apr 7, 2026

@copilot so where's the plan ? why did you open an empty PR ?

Optional/not-provided data inputs are recorded as None in
JobToInputDatasetAssociation. Add a filter to skip None datasets
when checking for purged input datasets.

Agent-Logs-Url: https://github.com/mvdbeek/galaxy/sessions/a79f3cf8-2b82-407f-aadb-144eb1ede32e

Co-authored-by: mvdbeek <6804901+mvdbeek@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix AttributeError on dataset access in job files API Fix AttributeError when job input dataset association has no dataset Apr 7, 2026
Copilot AI requested a review from mvdbeek April 7, 2026 19:11
Copy link
Copy Markdown
Author

Copilot AI commented Apr 7, 2026

@copilot so where's the plan ? why did you open an empty PR ?

The fix is in commit d30ccfd. It adds an if jtid.dataset filter to skip None dataset associations in the generator expression on line 71. The extra formatting changes are from ruff format as requested in the issue instructions. Sorry about the empty initial commit.

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.

AttributeError: 'NoneType' object has no attribute 'dataset'

2 participants