tonhowtf/omniget · error

Grok nao respondeu (modelo ` ` pode nao existir mais…

Error message

Grok nao respondeu (modelo `{}` pode nao existir mais; troque nas opcoes)

What it means

After consuming the entire NDJSON response, if no assistant text was extracted (neither result.message nor result.response.token chunks), ask_x throws `Grok nao respondeu (modelo `{model}` pode nao existir mais; troque nas opcoes)`. The library explicitly suspects the configured x_model option id is retired, so the stream produced nothing usable.

Solutions

  1. Change the model: set x_model in grok.json (or pass req.model) to a currently valid Grok model option id.
  2. Inspect the raw NDJSON (temporarily log `raw`) to see whether chunks carry a new shape and update the parser paths (/result/message, /result/response/token).
  3. Switch to the xai backend (configure xai_key) which uses the official API with stable model names.
  4. Retry later if X's Grok service is degraded and returns empty streams.

Example fix

// before
"grokModelOptionId": "grok-3"  // retired id, empty stream -> nao respondeu
// after
cfg.x_model = "grok-4"         // current option id picked from x.com/i/grok
Defensive patterns

Strategy: fallback

Validate before calling

// check the model id is current before calling
if cfg.x_model != CURRENT_KNOWN_X_MODEL { return Err("x_model may be retired; update grok.json"); }

Try / catch

match grok::ask(req).await {
    Ok(a) => use_answer(a),
    Err(e) if e.to_string().contains("Grok nao respondeu") => {
        let new_model = pick_current_model_option_id();
        let mut req2 = req.clone(); req2.model = new_model;
        grok::ask(req2).await.or_else(|_| use_xai_backend(req))
    }
    Err(e) => log_error(e),
}

Prevention

When it happens

Trigger: All NDJSON lines parsed but yielded no non-USER message and no token: the grokModelOptionId no longer matches any model X offers, Grok returned only error chunks with text already non-empty (skipped), or the response shape changed so the parsing paths miss the payload.

Common situations: X silently retiring model option ids like the default `grok-3` (the module header notes ids churn); stale grok.json holding a dead model id; upstream schema change in add_response NDJSON breaking token extraction.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/273dd09ad4156baf. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/x/grok.rs:379

                            url: url.to_string(),
                            title: w
                                .get("title")
                                .and_then(|t| t.as_str())
                                .unwrap_or("")
                                .to_string(),
                        });
                    }
                }
            }
        }
        if let Some(err) = r.get("error").and_then(|e| e.as_str()) {
            if text.is_empty() {
                return Err(anyhow!("Grok: {}", err));
            }
        }
    }
    if text.trim().is_empty() {
        return Err(anyhow!(
            "Grok nao respondeu (modelo `{}` pode nao existir mais; troque nas opcoes)",
            model
        ));
    }
    Ok(GrokAnswer {
        text,
        citations,
        model,
        backend: "x".into(),
        input_tokens: 0,
        output_tokens: 0,
    })
}

View on GitHub (pinned to 8600b91f42)