Getting this error on a decorated function that takes in text optimized for vector embedding:
(Postgrex.Error) ERROR 22001 (string_data_right_truncation) value too long for type character varying(255)
@job queue: :embeddings
def insert_embedding(%{text: text}) do
Usually I’ve ran into this because a schema somewhere is set to :string
type instead of :text
; and it would normally need a migration to change the type.
e.g
add :title, :string # only allows up to 255 length
add :description, :text # allows variable length
Hope that’s helpful to you.
Oban doesn’t use varchar (the :string
type) for any columns. All columns use the :text
type instead, and args
in particular uses jsonb.
Is it possible that the error is coming from application code, within the function itself?
1 Like