elkowar/eww · error
The script for the ` `-variable exited unsuccessfully
Error message
The script for the `{}`-variable exited unsuccessfully What it means
run_poll_once executes a polling script variable's command once and returns its output as a DynVal. For a shell command source, a non-zero exit is converted into this error (with a contextual warning naming the var and command); for a function source, any returned error is propagated.
Solutions
- Run the command manually and fix the non-zero exit condition
- Make the script resilient: append `|| echo fallback` or handle expected failures inside the script
- Suppress stderr / normalize exit codes for commands that legitimately report via exit codes
Example fix
// before (defpoll net :interval "5s" "curl -fsSL https://example.com/health") ; fails when offline // after (defpoll net :interval "5s" "curl -fsSL https://example.com/health || echo offline")
Defensive patterns
Strategy: try-catch
Validate before calling
# sanity-check the poll command exits 0 bash -c "$(grep -oP '(?<=:command ")[^"]+' ~/.config/eww/eww.yuck)" || echo fix
Try / catch
match script_var_handler::run_poll_once(&var) {
Ok(v) => update(v),
Err(e) => { log::warn!("poll failed: {e:#}"); keep_last_value(); }
} Prevention
- Make poll scripts idempotent and always exit 0 on expected failures
- Redirect stderr and emit fallback text
- Avoid transient-network commands without `|| echo fallback`
When it happens
Trigger: The poll loop (or an explicit `eww poll` via force_poll_variable) invokes run_poll_once and the var's shell command exits non-zero, or its Rust function source returns Err.
Common situations: Script depends on a missing binary; intermittent failures (network check, acpi absent); quoting/whitespace bugs in the command; command returns non-zero on transient conditions.
Related errors
- Script var ' ' is not polling
- The script for the ` `-variable exited unsuccessfully
- Failed with output
- CSS error
- Encountered both an SCSS and CSS file. Only one of these…
AI-assisted analysis of elkowar/eww@48f5aa8b37 (2026-09-08).
Data as JSON: /api/errors/82a4dd017bcbf70e.
Report an issue: GitHub.
Appendix: source
Thrown at crates/eww/src/script_var_handler.rs:202
});
}
fn stop_for_variable(&mut self, name: &VarName) {
if let Some(token) = self.poll_handles.remove(name) {
log::debug!("stopped poll var {}", name);
token.cancel()
}
}
fn stop_all(&mut self) {
self.poll_handles.drain().for_each(|(_, token)| token.cancel());
}
}
pub fn run_poll_once(var: &PollScriptVar) -> Result<DynVal> {
match &var.command {
VarSource::Shell(span, command) => {
script_var::run_command(command).map_err(|e| anyhow!(create_script_var_failed_warn(*span, &var.name, &e.to_string())))
}
VarSource::Function(x) => x().map_err(|e| anyhow!(e)),
}
}
impl Drop for PollVarHandler {
fn drop(&mut self) {
self.stop_all();
}
}
struct ListenVarHandler {
evt_send: UnboundedSender<DaemonCommand>,
listen_process_handles: HashMap<VarName, cancellation::AwaitableCancelationSender>,
}
impl ListenVarHandler {
fn new(evt_send: UnboundedSender<DaemonCommand>) -> Result<Self> {View on GitHub (pinned to 48f5aa8b37)