t8y2/dbx · error

IoTDB Go client panicked while executing statement

Error message

IoTDB Go client panicked while executing statement: %v

What it means

The driver wraps session.ExecuteStatementWithContext in a recover guard because some IoTDB Go client failures manifest as panics. When a panic occurs, the deferred function converts it into a regular error 'IoTDB Go client panicked while executing statement: %v' so callers get a normal error instead of crashing the process.

Solutions

  1. Inspect the wrapped panic value in the error message for the root cause
  2. Recreate/refresh the session and retry the statement
  3. Upgrade the IoTDB Go client library to a version with the panic fixed
  4. Avoid sharing the session across goroutines without synchronization

Example fix

// before
rows, err := conn.QueryContext(ctx, sql) // process died on panic
// after
rows, err := conn.QueryContext(ctx, sql)
if err != nil && strings.Contains(err.Error(), "panicked") {
    session, err = openSession(cfg) // recover by reopening session
}
Defensive patterns

Strategy: try-catch

Try / catch

rows, err := conn.QueryContext(ctx, sql)
if err != nil {
  var retriable bool
  if strings.Contains(err.Error(), "IoTDB Go client panicked") {
    retriable = true // reopen session before retry
  }
  if !retriable {
    return err
  }
  if err := reopenSession(ctx); err != nil { return err }
  rows, err = conn.QueryContext(ctx, sql)
}

Prevention

When it happens

Trigger: Executing a statement through the driver's execute helper when the IoTDB Go client panics internally (nil dataset handling, malformed response, closed session race).

Common situations: Server closed the connection mid-query; unsupported data type in the response triggering a client nil-deref; concurrent use of a session from multiple goroutines.

Related errors


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

Appendix: source

Thrown at agents/drivers/iotdb/driver.go:57

		return dataset.Close()
	}
	return nil
}

func (s *nativeIoTDBSession) Close() error {
	return s.session.Close()
}

func executeIoTDBStatement(ctx context.Context, session *client.Session, sql string) (dataset *client.SessionDataSet, err error) {
	defer func() {
		if recovered := recover(); recovered != nil {
			if ctxErr := ctx.Err(); ctxErr != nil {
				dataset = nil
				err = ctxErr
				return
			}
			dataset = nil
			err = fmt.Errorf("IoTDB Go client panicked while executing statement: %v", recovered)
		}
	}()
	return session.ExecuteStatementWithContext(ctx, sql)
}

type connectionConfig struct {
	Host                  string
	Port                  int
	NodeURLs              []string
	Username              string
	Password              string
	Database              string
	Dialect               string
	FetchSize             int32
	TimeZone              string
	ConnectRetryMax       int
	ConnectTimeoutMS      int
	EnableCompression     bool

View on GitHub (pinned to c0390bff16)