Skip to content

Bug: Prompts starting with '---' parsed as CLI options — silent launch failure #91

@c-h-

Description

@c-h-

Bug: Prompts starting with --- are parsed as CLI options, crashing the launch

Problem

When launching Claude Code via agentctl launch claude-code -p "<prompt>" where the prompt content begins with --- (e.g., YAML frontmatter from a spec file), Claude Code's argument parser interprets --- as an invalid CLI option flag and exits immediately:

error: unknown option '---

The session never starts. agentctl reports success ("Launched session pending-XXXXX") because the process was spawned, but it exits immediately with an arg parse error.

Reproduction

agentctl launch claude-code --cwd /tmp/test -p "---
title: test
---
Build this."

Impact

  • Silent failure — agentctl reports success but no work happens
  • Discovered after two wasted launches (dashboard-redesign and unified-feed)
  • Any prompt containing a spec file with YAML frontmatter will fail

Suggested Fixes

In agentctl (workaround):

  • Prefix prompts that start with - with a newline or space to prevent arg parser confusion
  • Or write the prompt to a temp file and use --prompt-file if Claude Code supports it

In Claude Code (root cause):

  • The --print -p argument should not be parsed for sub-options. Everything after -p should be treated as literal prompt text.

Environment

  • agentctl 1.5.2
  • Claude Code 2.1.52

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions