Hmbown/CodeWhale · warning

PTY resize is unavailable on this platform

Error message

PTY resize is unavailable on this platform

What it means

On the ohos target environment the PTY master implementation has no resize capability, so resize_pty is hard-wired to return 'PTY resize is unavailable on this platform'. The size argument is deliberately ignored (let _ = size). This is a static platform limitation, not a job-state problem — it fires for every resize call under cfg(target_env = "ohos").

Solutions

  1. Skip PTY resize calls on ohos; guard the call site with a platform check and treat resize as a no-op there.
  2. Persist the requested size (shell.terminal_size) and apply it at next spawn on supported platforms if the size must not be lost.
  3. If resize support is required, use a platform that exposes PTY resize (not(target_env = "ohos")) or contribute an ohos resize implementation to the PTY backend.
  4. Update any feature-detection/UI affordances to hide the resize control on ohos.

Example fix

// before
manager.resize_pty(task_id, size)?;
// after
#[cfg(not(target_env = "ohos"))]
manager.resize_pty(task_id, size)?;
#[cfg(target_env = "ohos")]
let _ = size; // PTY resize unsupported on ohos
Defensive patterns

Strategy: fallback

Validate before calling

// Rust: compile-time/platform gate before calling resize
#[cfg(target_env = "ohos")]
fn pty_resize_supported() -> bool { false }
#[cfg(not(target_env = "ohos"))]
fn pty_resize_supported() -> bool { true }

if pty_resize_supported() {
    manager.resize_pty(task_id, size)?;
} else {
    eprintln!("PTY resize unsupported on this platform; ignoring");
}

Try / catch

match manager.resize_pty(task_id, size) {
    Ok(()) => (),
    Err(e) if e.to_string().contains("unavailable on this platform") => {
        // remember the size for a future spawn instead; do not retry
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Any call to resize_pty on a build targeting OHOS (target_env = "ohos"), regardless of job state or requested dimensions.

Common situations: Running the TUI on an OpenHarmony device where the user resizes the terminal; tests compiled for the ohos target exercising PTY resize; porting code that assumes portable-pty resize support.

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/d080bed474a8e98e. Report an issue: GitHub.

Appendix: source

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

        );
        #[cfg(not(target_env = "ohos"))]
        {
            let master = shell.pty_master.as_ref().context("Job is not a PTY")?;
            master
                .resize(PtySize {
                    rows: size.rows,
                    cols: size.cols,
                    pixel_width: 0,
                    pixel_height: 0,
                })
                .context("Failed to resize PTY")?;
            shell.terminal_size = Some(size);
            Ok(())
        }
        #[cfg(target_env = "ohos")]
        {
            let _ = size;
            Err(anyhow!("PTY resize is unavailable on this platform"))
        }
    }

    pub fn write_stdin_for_session(
        &mut self,
        active_session_id: &str,
        task_id: &str,
        input: &str,
        close: bool,
    ) -> Result<()> {
        self.require_session_owner(task_id, active_session_id)?;
        self.write_stdin(task_id, input, close)
    }

    /// Get incremental output from a background process, consuming any new output.
    fn get_output_delta(
        &mut self,
        task_id: &str,

View on GitHub (pinned to 73e0f67d83)