1301
MariaDBerrorstored-procedureshigh confidence

End-label does not match begin-label

Production Risk

Low — compile-time error; routine not created.

What this means

The end label of a labeled block or loop does not match the begin label.

Why it happens
  1. 1Typo in the closing label
  2. 2Copy-paste error where labels were not kept in sync
How to reproduce
trigger — this will error
trigger — this will error
CREATE PROCEDURE p() BEGIN start_lbl: LOOP END LOOP end_lbl; END;

expected output

ERROR 1301 (42000): End-label 'end_lbl' without match

Fix

Match begin and end labels

Match begin and end labels
CREATE PROCEDURE p() BEGIN my_loop: LOOP END LOOP my_loop; END;

Why this works

Begin and end labels must be identical.

Sources
Official documentation ↗

MySQL 8.0 — 1301 ER_SP_LABEL_MISMATCH

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors