Skip to content

validate --all hangs indefinitely when no changes or specs exist #363

@yidecode

Description

@yidecode

Bug Description

When running openspec validate --all --strict --no-interactive in a repository with no active changes and no specs (empty openspec/changes/ and openspec/specs/ directories), the command hangs indefinitely with the spinner showing "Validating...".

Steps to Reproduce

  1. Create an openspec directory structure with no changes or specs:
    mkdir -p openspec/changes/archive openspec/specs
  2. Run: openspec validate --all --strict --no-interactive
  3. Command hangs forever

Expected Behavior

Should complete immediately with a message like "No items to validate" and exit with code 0.

Root Cause

In src/commands/validate.ts runBulkValidation() method, when both changeIds and specIds are empty arrays, the queue length is 0, but the Promise resolution logic doesn't handle this edge case properly, causing the command to hang.

Suggested Fix

Add an early return when queue.length === 0 before entering the concurrent execution logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions