Msg 3902 Level 16 - The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION

On Transact SQL language the Msg 3902 Level 16 - The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION means that the command begin tranasaction is missing.

Msg 3902 Level 16 Example:

Invalid TRANSACTION

USE tempdb;
GO
INSERT INTO dbo.departments (ID, NAME) VALUES (10, N'd1');
INSERT INTO dbo.departments (ID, NAME) VALUES (20, N'd2');
INSERT INTO dbo.departments (ID, NAME) VALUES (30, N'd3');
INSERT INTO dbo.departments (ID, NAME) VALUES (40, N'd4');
GO
COMMIT WORK;
GO

Message
Msg 3902, Level 16, State 1, Line 8
The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

Correct TRANSACTION:

USE tempdb;
GO
BEGIN TRANSACTION;
GO
INSERT INTO dbo.departments (ID, NAME) VALUES (10, N'd1');
INSERT INTO dbo.departments (ID, NAME) VALUES (20, N'd2');
INSERT INTO dbo.departments (ID, NAME) VALUES (30, N'd3');
INSERT INTO dbo.departments (ID, NAME) VALUES (40, N'd4');
GO
COMMIT WORK;
GO

Other error messages: