---
id: TASK-12
title: Reject --list/--image for non-sysbuild projects in flash/run
status: Done
assignee:
  - codex
created_date: '2026-02-04 16:47'
updated_date: '2026-02-04 17:30'
labels:
  - bug
dependencies: []
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
`zync flash` and `zync run` should fail with a clear error when `--list/-l` or `--image/-i` are used in non-sysbuild projects. Currently these flags appear to succeed without effect, which is misleading.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 `zync flash --list/-l` fails with a clear error when invoked on non-sysbuild projects.
- [x] #2 `zync run --list/-l` fails with a clear error when invoked on non-sysbuild projects.
- [x] #3 `zync flash --image/-i` fails with a clear error when invoked on non-sysbuild projects.
- [x] #4 `zync run --image/-i` fails with a clear error when invoked on non-sysbuild projects.
- [x] #5 Tests cover these failure cases and assert non-zero exit status and messaging.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1. Locate where --list/-l and --image/-i are parsed and validated for flash/run, and where sysbuild detection is available in config.
2. Add validation in command handlers (or shared validation) to error out when list or image is used and config.sysbuild is false; ensure clear message and non-zero exit.
3. Add Busted tests covering flash/run with --list and --image on non-sysbuild projects, asserting error message and non-zero exit.
4. Run relevant tests.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added non-sysbuild guard for --list/--image in Manager.flash and Manager.run with clear log messages and non-zero exit codes. Added Busted coverage in manager_spec for flash/run list/image non-sysbuild cases. Tests: `busted -c spec/api_spec/manager_spec.lua`, `busted -c`.
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Summary:
- Added non-sysbuild guards in flash/run to reject --list/--image with clear error messages and non-zero exit.
- Added manager spec coverage for flash/run list/image error cases on non-sysbuild projects.

Tests:
- busted -c spec/api_spec/manager_spec.lua
- busted -c
<!-- SECTION:FINAL_SUMMARY:END -->
