t8y2/dbx · error

TDengine query returned an empty value

Error message

TDengine query returned an empty value

What it means

Bailed by query_scalar_string (TDengine driver) when a scalar query expected to return exactly one string value produced an empty/unusable result — the fetched block carried no convertible text (distinct from the 'returned no rows' case where no block arrived at all). The caller (connect or validate_connection) relies on that scalar, so the operation aborts.

Source

Thrown at agents/drivers/tdengine/src/driver.rs:775

}

async fn query_scalar_string(
    connection: &Taos,
    sql: &str,
    token: &CancellationToken,
    timeout_secs: u64,
) -> Result<String> {
    let mut result = cancellable(token, timeout_secs, connection.query(sql)).await?;
    let timezone = result.timezone();
    loop {
        let block = cancellable(token, timeout_secs, poll_fn(|context| result.fetch_raw_block(context))).await?;
        let Some(block) = block else {
            bail!("TDengine query returned no rows");
        };
        if block.nrows() == 0 || block.ncols() == 0 {
            continue;
        }
        let value = block.get_ref(0, 0).ok_or_else(|| anyhow!("TDengine query returned an empty value"))?;
        return match borrowed_value_to_json(value, preferred_timezone(timezone, block.timezone(), None)) {
            Value::String(value) => Ok(value),
            value => Ok(value.to_string()),
        };
    }
}

fn preferred_timezone(
    query_timezone: Option<Tz>,
    block_timezone: Option<Tz>,
    session_timezone: Option<Tz>,
) -> Option<Tz> {
    query_timezone.or(block_timezone).or(session_timezone)
}

fn parse_server_timezone(value: &str) -> Option<Tz> {
    value.split_whitespace().next()?.parse().ok()
}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Verify server_version()/timezone() queries return values by running them in the TDengine CLI
  2. Check for a server version the WebSocket connector cannot parse
  3. Reconnect and retry; a wedged taosAdapter can return empty results
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at agents/drivers/tdengine/src/driver.rs:775 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/203d8dd6cc3789f1. Report an issue: GitHub.