Skip to content

[bug] Extism drops WASM output on non-zero exit code #94

@robbyt

Description

@robbyt

Summary

engines/extism/evaluator/evaluator.go:79-82:

if exit != 0 {
    // TODO should we return the output in this case?
    return nil, execTime, fmt.Errorf("function returned non-zero exit code: %d", exit)
}

When a WASM function returns non-zero, the output bytes are discarded. This makes diagnosing a misbehaving plugin harder than it needs to be — the plugin may have written a structured error to its output buffer that we're throwing away.

Proposal

Two options:

  1. Include a quoted/truncated form of the output in the error message: function returned non-zero exit code: %d (output: %q).

  2. Expose an ExitError type:

    type ExitError struct {
        ExitCode int32
        Output   []byte
    }

    so callers can errors.As and inspect the output.

(2) is more useful long-term but is a public-API addition, so probably belongs together with the v1 EvaluatorResponse work.

Files

  • engines/extism/evaluator/evaluator.go:62-101

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions