Skip to content

NOT NULL constraint failed: action_run.concurrency_group prevents all workflow runs on SQLite #38916

Description

@JumpingY

Gitea Version

NOT NULL constraint failed: action_run.concurrency_group

What happened?

Description

When triggering a workflow (e.g. issues event) on Gitea 1.27.1/1.27.2 with SQLite, the workflow is detected and matched correctly, but the run is never inserted into the database. The action_run table remains empty, and the following error is logged: [E] repo owner/repo.git: PrepareRunAndInsert: InsertRun: constraint failed: NOT NULL constraint failed: action_run.concurrency_group (1299)

Root Cause

The action_run table defines concurrency_group as NOT NULL without a DEFAULT value. In services/actions/run.go, db.Insert(ctx, run) is called before the concurrency configuration is parsed and concurrency_group is populated (lines 73-88). At insert time, the field is still NULL/empty, so SQLite rejects the insert. Adding a concurrency: block in the workflow YAML does not work around this, because the concurrency evaluation happens after the initial insert.

Comparison with other tables

Table Field Constraint Has DEFAULT?
action_run concurrency_group NOT NULL ❌ No

Database SQLite3

How to reproduce

  1. Create a workflow triggered by issues event (or any event): yaml name: Issue Notify on: issues: types: [opened, edited, closed, reopened] jobs: notify: runs-on: ubuntu-latest steps: - run: echo "triggered"
  2. Edit an issue
  3. Check act_run table — it's empty
  4. Check Gitea logs — NOT NULL constraint failed: action_run.concurrency_group (1299)

Expected behavior

The run should be inserted into action_run successfully, even when no concurrency: block is specified in the workflow YAML.

Suggested fix

Add DEFAULT '' to the concurrency_group column in action_run, consistent with the other two tables. Either:

  1. Fix the xorm tag / migration to include NOT NULL DEFAULT '' (matching action_run_attempt and action_run_job)
  2. Or remove the NOT NULL constraint entirely

Workaround

Drop the empty action_run table and restart Gitea — xorm will recreate it. However, this only works if the table has no data. For tables with existing data, a proper migration is needed.

How are you running Gitea?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions