NV1001Compiler

Unknown Identifier

The compiler encountered an identifier, variable, or function name that has not been declared or is not in scope.

FnArgsBody

Why this error occurs

This happens when a variable or function is referenced before its declaration, when a name is misspelled, when a variable was declared in an inner scope, or when an imported symbol is missing.

Incorrect Code
// incorrect: 'calculate_tax' is referenced before declaration or misspelled
let total = calculate_tax(100.0)

fn calc_tax(amount):
    return amount * 0.08
Corrected Code
// corrected: define function or variable before using it
fn calc_tax(amount):
    return amount * 0.08

let total = calc_tax(100.0)
print(total)

Troubleshooting & Remediation

  • 1Check spelling and casing of the variable or function name.
  • 2Ensure the variable is declared before the line where it is referenced.
  • 3Verify that the identifier was exported from the imported module.
  • 4Check block scope boundaries (variables defined in 'if' or 'for' blocks are not accessible outside).

Relevant CLI Commands

$ nextviper check$ nextviper check --format=json