Ad Space — Top Banner

E2029

Delphi Programming Language

Severity: Minor

What Does This Error Mean?

Error E2029 means Delphi's compiler expected to find a valid identifier (a name) at a specific point in your code, but found something else instead — like a keyword, a number, a symbol, or nothing at all. This is a syntax error that always happens before your program compiles. It usually means a missing name, a misplaced keyword, or a structural mistake in a declaration.

Affected Models

  • Delphi 2005 and later
  • RAD Studio
  • Lazarus/Free Pascal (similar error)

Common Causes

  • A missing identifier name after a keyword like var, type, const, procedure, or function
  • Using a reserved keyword as a variable or parameter name
  • A misplaced semicolon or comma breaking the structure of a declaration
  • Forgetting the class or record field name after its type in a declaration
  • An incomplete or malformed declaration that the parser cannot make sense of

How to Fix It

  1. Double-click the error to jump to the line. Look at what word or symbol appears where Delphi expected an identifier name.

    Common clue: the error is on a keyword, a semicolon, or an operator instead of a name.

  2. If you declared a variable, parameter, or field, make sure you provided a name for it. Every declaration needs a name before the colon and type.

    Correct: var MyName: string; — Incorrect: var: string; (missing the name).

  3. Check that you are not using a Delphi reserved word as an identifier name. Words like begin, end, var, type, class, procedure, function, record are reserved.

    The Delphi editor highlights reserved words in bold. If your variable name is bold, rename it.

  4. Look at the lines just before the error. A missing semicolon or begin/end at the end of the previous block can push the parser into a state where it expects something unexpected.

    Delphi errors often appear one or two lines after the actual mistake.

  5. Check all function and procedure declarations. Every parameter needs a name, a colon, and a type. Every function needs a name and a return type after the colon.

    Example: function GetName(AIndex: Integer): string; — all three parts must be present.

When to Call a Professional

E2029 is always something you can fix yourself. The error message and the highlighted line tell you exactly where Delphi expected to find an identifier. Look at the surrounding code structure and make sure all declarations are complete and properly formed.

Frequently Asked Questions

Why does E2029 appear on a line that looks correct?

The actual mistake is often on an earlier line. For example, a missing semicolon at the end of the previous statement makes Delphi try to continue parsing in the wrong direction. When it reaches your correct line, it is now in a confused state and reports the error there. Always look a few lines before the reported error.

Can I name a variable the same as a unit or type?

You can, but it is not recommended. If you name a local variable 'Button' when TButton exists, Delphi might get confused about which you mean. Giving variables descriptive names that do not clash with type or unit names makes your code cleaner and avoids confusing compiler errors.

What is an identifier in Delphi exactly?

An identifier is any name you (or Delphi) give to something in the code — variables, constants, types, functions, procedures, units, classes, and properties. Identifiers must start with a letter or underscore, and can contain letters, digits, and underscores. They cannot start with a number and cannot be a reserved keyword.