Pipeline run pages return 500 for a schedule whose pipeline is not registered

Open Beginner friendly
#2,505 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@sanchit955 is already working on this.

Since Nov 17, 2026.

  • #2506 by @sanchit955 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
django, postgresql, python
Domain
backend, databases

Research direction

Start with PipelineSchedule.pipeline_class in vulnerabilities/models.py, then trace its use in PipelineRunListView and PipelineRunDetailView and in PipelineRun.pipeline_url. Run the new PipelineRunViewsUnregisteredPipelineTestCase in vulnerabilities/tests/test_view.py; done means both run pages return 200 for an unregistered pipeline and show its id as the page name.

Written by the indexing model from the issue text.

Description

Problem

PipelineSchedule rows persist in the database. When a pipeline is removed or renamed (for example the open "Remove v1 code" work), every stale schedule's run pages crash:

  • GET /pipelines/<pipeline_id>/runs/ → 500
  • GET /pipelines/<pipeline_id>/run/<uuid>/ → 500

Evidence

PipelineSchedule.pipeline_class (vulnerabilities/models.py) does a bare dict lookup, pipeline_registry[self.pipeline_id], which raises KeyError for an id that is no longer registered. Both PipelineRunListView.get_context_data and PipelineRunDetailView.get_context_data dereference it (pipeline_class.__name__), and the run detail template also reaches it through PipelineRun.pipeline_url when the run has a commit recorded.

Reproduced locally on PostgreSQL 16 with a schedule and a run using pipeline_id="hunt_probe_no_such_pipeline": both pages 500 with KeyError: 'hunt_probe_no_such_pipeline'. The dashboard list page is not affected — its template never calls pipeline_class.

Fix

  • pipeline_class returns None for an unregistered id (.get() instead of []); description already guards on a falsy class.
  • Both views fall back to the raw pipeline_id as the page name when the class is unknown.
  • pipeline_url returns None when the class is unknown, so the detail template's commit link degrades cleanly.

Tests

New PipelineRunViewsUnregisteredPipelineTestCase in vulnerabilities/tests/test_view.py: both pages return 200 with the pipeline id as the name for an unregistered pipeline. Both tests fail on unmodified main and pass with the fix. Full test_view.py: 14 passed (1 pre-existing flaky timing failure in test_aggregate_fixed_and_affected_packages, fails on main too); pipeline model tests 10 passed.

Dominant language
Python
Stars
719
Forks
359
Avg merge
11h 59m
Merged PRs (30d)
2

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

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 aboutcode-org/vulnerablecode

All issues in aboutcode-org/vulnerablecode

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.