jackc/pgx · error

expected statement description, got %T

Error message

expected statement description, got %T

What it means

Error "expected statement description, got %T" thrown in jackc/pgx.

Source

Thrown at conn.go:1207

						sdCache.Invalidate(sd.SQL)
					}
				}
			}()

			err = pipeline.Sync()
			if err != nil {
				return err
			}

			for _, sd := range distinctNewQueries {
				results, err := pipeline.GetResults()
				if err != nil {
					return newErrPreprocessingBatch("prepare", sd.SQL, err)
				}

				resultSD, ok := results.(*pgconn.StatementDescription)
				if !ok {
					return fmt.Errorf("expected statement description, got %T", results)
				}

				// Fill in the previously empty / pending statement descriptions.
				sd.ParamOIDs = resultSD.ParamOIDs
				sd.Fields = resultSD.Fields
			}

			results, err := pipeline.GetResults()
			if err != nil {
				return err
			}

			_, ok := results.(*pgconn.PipelineSync)
			if !ok {
				return fmt.Errorf("expected sync, got %T", results)
			}

			return nil

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at conn.go:1207 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jackc/pgx@ec1a0befd2 (2026-08-04). Data as JSON: /data/errors/ec7b992143d4ee53.json. Report an issue: GitHub.