Hmbown/CodeWhale · error

TTY shell mode is not supported on HarmonyOS/OpenHarmony…

Error message

TTY shell mode is not supported on HarmonyOS/OpenHarmony yet.

What it means

TTY shell mode is explicitly unimplemented on HarmonyOS/OpenHarmony (target_env = "ohos"). The ohos platform lacks the PTY support this tool's TTY path needs, so the compile-time `#[cfg(target_env = "ohos")]` guard rejects any foreground request that sets `tty: true` before any process is spawned.

Solutions

  1. Omit `tty: true` and run the command in non-TTY mode, capturing stdout/stderr directly
  2. Implement the ohos PTY backend in the tool to lift the platform guard
  3. Use a desktop build (Linux/macOS/Windows) when interactive TTY commands are required
  4. Redirect input/output through files or pipes instead of a pseudo-terminal

Example fix

// before
{ "command": "vim notes.txt", "tty": true }
// after (on ohos)
{ "command": "vim notes.txt" } // tty unsupported on ohos; use non-interactive commands
Defensive patterns

Strategy: validation

Validate before calling

// ohos builds: never request a TTY
if cfg!(target_env = "ohos") && request.tty {
    // drop tty or route through a non-pty path before calling
}

Prevention

When it happens

Trigger: Calling the shell/bash tool with `tty: true` on a build compiled for target_env = "ohos" (HarmonyOS/OpenHarmony), regardless of background setting in this code path.

Common situations: Running Codewhale on ohos-based devices or emulators and requesting TTY/interactive commands; cross-compiling for ohos and expecting feature parity with desktop Unix builds.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/2a2ddec441a53842. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tools/shell.rs:2572

            owner_session_id,
            origin_tool_call_id,
            origin_turn_id,
            work_lifecycle,
        } = spawn_context;
        let task_id = format!("shell_{}", &Uuid::new_v4().to_string()[..8]);
        let mut spawn_guard =
            ShellSpawnIntentGuard::new(work_lifecycle.clone(), &task_id, original_command);
        let started = Instant::now();
        let sandbox_type = exec_env.sandbox_type;
        let sandboxed = exec_env.is_sandboxed();

        // Build the command from ExecEnv
        let program = exec_env.program();
        let args = exec_env.args();

        #[cfg(target_env = "ohos")]
        if tty {
            return Err(anyhow!(
                "TTY shell mode is not supported on HarmonyOS/OpenHarmony yet."
            ));
        }

        let stdout_buffer = new_shared_raw_output();
        let stderr_buffer = if tty || persist_pending || small_contract_mode {
            None
        } else {
            Some(new_shared_raw_output())
        };
        // The spill file is best-effort: a full disk or exhausted descriptor
        // table must not make `echo ok` unrunnable (that is exactly how the
        // owner's session got wedged under swap exhaustion).
        let bounded_output = small_contract_mode.then(|| {
            Arc::new(Mutex::new(BoundedOutputAccumulator::new_in(
                self.output_spill_dir.as_deref(),
            )))
        });

View on GitHub (pinned to 73e0f67d83)