PriyoScriptPriyoScript
Reference

Error Codes Reference

Complete reference for PriyoScript syntax, compile, runtime, and engine error codes.

Theory

Error codes are stable identifiers that map failures to specific language/runtime rules. They make debugging faster because you can search by exact code instead of guessing from a generic message.

Stages and Categories

Error stages

StageMeaning
syntaxSource parsing/grammar failure
compileAST-to-bytecode generation failure
runtimeFailure during program execution
coreInternal engine-level failure

Error categories

CategoryMeaning
userError caused by program/code usage
engineInternal runtime/compiler failure

CLI Commands

monalisa -errors
monalisa -explain <ERROR_CODE>

Diagnostics Output Format (What You Will See)

When PriyoScript prints an error now, it includes a richer context block to help you locate issues faster:

  • Type and Category (user vs engine)
  • Phase (parse/compile/vm)
  • Context with line numbers and a caret span
  • Module import hints like Import source and Tried paths

Example output (shape only, values vary by error):

So Rude - The requested module could not be loaded.
FYI (Tip): Use `./`, `../`, or `/` imports; PriyoScript also tries `path.priyo` and `path/index.priyo`. Ensure module starts with `lisaaBox { ... }` and avoid cyclic imports.
Code: PRUN-110
Type: PriyoRuntimeError
Stage: runtime
Category: user
Phase: vm
Location: /project/examples/modules/main.priyo:3:3
Context:
  2 | monalisa {
> 3 |   lisaaBring "./college.priyoo": college
    |           ^^^^^^^^^^^^^^^^^^^^^
  4 | }
Import source: ./college.priyoo
Tried paths: /project/examples/modules/college.priyoo, /project/examples/modules/college.priyoo.priyo, /project/examples/modules/college.priyoo/index.priyo
Docs: https://priyyoscript.vercel.app/docs/stable/reference/errors-reference#prun-110

Complete Error Code Table

CodeStageCategoryMeaning
PSYN-001syntaxuserParse failed
PSYN-002syntaxuserIllegal token / unexpected token
PSYN-003syntaxuserReserved/forbidden word usage
PSYN-004syntaxuserprakritiPause used outside async function
PCMP-001compileuserCompile failed
PRUN-000runtimeuserGeneric runtime failure
PRUN-101runtimeuserUndefined variable
PRUN-102runtimeuserConstant reassignment
PRUN-103runtimeuserDivision by zero
PRUN-104runtimeuserUnknown class
PRUN-105runtimeuserUnknown callable
PRUN-106runtimeuserProperty access/assignment error
PRUN-107runtimeuserArgument mismatch
PRUN-108runtimeuserInvalid input
PRUN-109runtimeuserUnknown package
PRUN-110runtimeuserUnknown module
PRUN-111runtimeuserFile not found
PRUN-112runtimeuserTask cancelled
PENG-001coreengineInternal engine error

Syntax Errors

PSYN-001 Parse failed

Incorrect

monalisa {
  priyoTell("hello"
}

Correct

monalisa {
  priyoTell("hello")
}

PSYN-002 Illegal token

Incorrect

monalisa {
  prakritiIff (priyoTrue) {
    priyoTell("ok")
  }
}

Correct

monalisa {
  prakritiIf (priyoTrue) {
    priyoTell("ok")
  }
}

PSYN-003 Reserved word usage

Incorrect

monalisa {
  priyoKeep class = 10
}

PSYN-004 Await outside async function

Wrong

monalisa {
  lisaaTask total(a, b) {
    priyoGiveBack prakritiPause (a + b)
  }
}

Correct

monalisa {
  prakritiWait lisaaTask total(a, b) {
    priyoGiveBack prakritiPause (a + b)
  }
}

Correct

monalisa {
  priyoKeep classCount = 10
}

Compile Error

PCMP-001 Compile failed

Incorrect

monalisa {
  priyoGiveBack 10
}

Correct

monalisa {
  lisaaTask getValue() {
    priyoGiveBack 10
  }
  priyoTell(getValue())
}

Runtime Errors

PRUN-000 Generic runtime failure

Incorrect

monalisa {
  priyoKeep x = priyoEmpty.foo
}

Correct

monalisa {
  priyoKeep obj = { foo: 10 }
  priyoTell(obj.foo)
}

PRUN-101 Undefined variable

Incorrect

monalisa {
  priyoTell(total)
}

Correct

monalisa {
  priyoKeep total = 10
  priyoTell(total)
}

PRUN-102 Const reassignment

Incorrect

monalisa {
  priyoPromise x = 1
  x = 2
}

Correct

monalisa {
  priyoChange x = 1
  x = 2
}

PRUN-103 Division by zero

Incorrect

monalisa {
  priyoTell(10 / 0)
}

Correct

monalisa {
  lisaaTask safeDiv(a, b) {
    prakritiIf (b == 0) { priyoGiveBack priyoEmpty }
    priyoGiveBack a / b
  }
  priyoTell(safeDiv(10, 2))
}

PRUN-104 Unknown class

Incorrect

monalisa {
  priyoKeep u = priyoCreate UnknownClass()
}

Correct

monalisa {
  lisaaFamily User {}
  priyoKeep u = priyoCreate User()
}

PRUN-105 Unknown callable

Incorrect

monalisa {
  priyoKeep x = 10
  x()
}

Correct

monalisa {
  lisaaTask x() {
    priyoTell("ok")
  }
  x()
}

PRUN-106 Property error

Incorrect

monalisa {
  priyoKeep x = priyoEmpty
  priyoTell(x.name)
}

Correct

monalisa {
  priyoKeep x = { name: "mona" }
  priyoTell(x.name)
}

PRUN-107 Argument mismatch

Incorrect

monalisa {
  lisaaTask add(a, b) {
    priyoGiveBack a + b
  }
  priyoTell(add(10))
}

Correct

monalisa {
  lisaaTask add(a, b) {
    priyoGiveBack a + b
  }
  priyoTell(add(10, 5))
}

PRUN-108 Invalid input

Incorrect

monalisa {
  priyoKeep age = priyoListenNumber("Age: ")
  priyoTell(age + 1)
}

Correct

monalisa {
  priyoKeep age = priyoListenNumber("Age: ")
  prakritiIf (age == priyoEmpty) {
    priyoTell.Warn("Invalid number")
  } prakritiElse {
    priyoTell(age + 1)
  }
}

PRUN-109 Unknown package

Incorrect

monalisa {
  lisaaBring maths
}

Correct

monalisa {
  lisaaBring math
}

PRUN-110 Unknown module

Incorrect

monalisa {
  lisaaBring "./college.priyoo": college
}

Correct

monalisa {
  lisaaBring "./college.priyo": college
}

Notes: The diagnostic now includes Import source and a Tried paths list so you can see exactly which files were attempted.

PRUN-111 File not found

Incorrect

monalisa {
  lisaaBring files
  priyoTell(files.readText("missing.txt"))
}

Correct

monalisa {
  lisaaBring files
  prakritiIf (files.exists("missing.txt")) {
    priyoTell(files.readText("missing.txt"))
  } prakritiElse {
    priyoTell("File not found")
  }
}

PRUN-112 Task cancelled

Incorrect

monalisa {
  prakritiWait lisaaTask worker(token) {
    token.throwIfCancelled()
    priyoGiveBack "done"
  }

priyoKeep group = priyoConcurrency.group("cancel")
priyoKeep token = group.token()
priyoKeep task = group.run(worker, token)
group.cancel("Stopped by user")
priyoTell(prakritiPause task.join())
}

Correct

monalisa {
  prakritiWait lisaaTask worker(token) {
    token.throwIfCancelled()
    priyoGiveBack "done"
  }

  priyoKeep group = priyoConcurrency.group("cancel")
  priyoKeep token = group.token()
  priyoKeep task = group.run(worker, token)
  group.cancel("Stopped by user")

  prakritiTry {
    priyoTell(prakritiPause task.join())
  } prakritiCatch (err) {
    priyoTell(err.code)
  }
}

Engine Error

PENG-001 Internal engine error

This is not a user-code logic mistake. It indicates an internal runtime/compiler/core issue.

Action:

  1. Save minimal reproducible .priyo code.
  2. Run with monalisa -trace <file>.
  3. Report with code, output, and environment details.

Reporting engine failures

For PENG-001, include the error code, source snippet, CLI command, and PriyoScript version in your report.

Practice Questions

Concept Check

  1. Which stage does PSYN-002 belong to, and why? 2. What is the difference between PRUN-109 and PRUN-110? 3. When should you treat an error as engine-level (PENG-001)?

Last updated on

On this page