postgresql – Does postgres’s ON CONFLICT based on unique index work?

My table

CREATE TABLE IF NOT EXISTS foo (
    id int,
    t text,
    f text,
    m text,
    created_at timestamptz,
    md json,
    c int DEFAULT 0
);
CREATE INDEX foo_unique_index ON foo(id, t, fv, md5(md::text));

And this is my insert query

INSERT INTO foo(id, t, fv, m, created_at, md) VALUES(?,?,?,?,?,?) ON CONFLICT (id, t, fv, md5(md::text)) DO UPDATE SET c = excluded.c + 1

But I get a psql exception with the error
cause ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification.

What am I doing wrong?