ReferenceControlArcReferenceErrors

Errors

Arc error code reference for compile-time and runtime errors

Arc errors fall into two categories: compile-time errors (caught before deployment) and runtime errors (occur during execution).

Error code format

Arc error codes follow the pattern:

ARC<category><number>

Table

Category Range Description
Type System ARC2xxx Type mismatches and constraint violations
Functions ARC3xxx Argument count and type errors
Symbols ARC4xxx Undefined or redefined symbols

Compile-time errors

The compiler catches these before deployment.

Type system errors (ARC2xxx)

Table

Code Name Description
ARC2001 TypeMismatch Incompatible types in operation or assignment
ARC2003 TypeConstraintViolation Type doesn’t satisfy constraint

Example: TypeMismatch

// Error: cannot add i32 and f64
x i32 := 42
y f64 := x + 1.0

Fix: Use explicit type casting:

x i32 := 42
y f64 := f64(x) + 1.0

Function errors (ARC3xxx)

Table

Code Name Description
ARC3001 FuncArgCount Wrong number of arguments
ARC3002 FuncArgType Function argument has wrong type

Example: FuncArgCount

func add(x f64, y f64) f64 {
    return x + y
}
// Error: expected 2 arguments, got 1
result := add(5.0)

Symbol errors (ARC4xxx)

Table

Code Name Description
ARC4001 SymbolUndefined Referenced symbol not found
ARC4002 SymbolRedefined Symbol conflicts with declaration in same or enclosing scope

Example: SymbolUndefined

// Error: undefined symbol 'ox_pt_1'
value := ox_pt_1 // channel doesn't exist in cluster

Example: SymbolRedefined

x := 42
x := 100 // Error: x already declared
func example() {
    x := 10
    if x > 0 {
        x := 20 // Error: conflicts with outer x
    }
}

Common error messages

Table

Message Meaning
"X is not a channel" Using a non-channel where a channel is expected
"X is not a function" Using {} syntax on something that isn’t a function
"X is not a channel or sequence" Invalid target for flow or transition
"X has more than one parameter" Function needs a routing table for multiple inputs
"input routing table must precede a func invocation" Routing table in wrong position
"compound assignment requires numeric element type" Using += etc. with non-numeric type
"undefined symbol: X" Symbol not declared (typo or missing channel)
"type mismatch" Incompatible types in operation
"authority value must be an integer in range 0-255" Authority value out of range
"authority declaration must appear before ..." Authority block after func/sequence declarations
"multiple default authority values" More than one bare numeric default in authority block
"duplicate authority for 'X'" Same channel listed twice in authority block
"channel 'X' not found" Authority references a channel that doesn’t exist
"missing return" Function with return type has no return statement
"unreachable code" Code after unconditional return

Runtime errors

These errors occur during execution and stop the Arc task (but not the Driver).

Arithmetic errors

Table

Error Cause
Division by zero Dividing by zero in / or %
// Runtime error if b is 0
result := a / b

Prevention:

if b != 0 {
    result := a / b
}

Array/string errors

Table

Error Cause
Out-of-bounds access Index outside valid range
Length mismatch Series operation with different-length arrays
data := [1.0, 2.0, 3.0]
value := data[5] // Runtime error: index 5 out of bounds

Prevention:

if index < len(data) {
    value := data[index]
}

Error isolation

A runtime error in one Arc task only stops that task. Other tasks and the hardware driver continue running normally. The error status is reported to Console where you can see what went wrong.

Debugging

Check task status

When an Arc automation doesn’t behave as expected:

  1. Check the task status in Console
  2. Runtime errors (division by zero, out-of-bounds) stop the task and report the error
  3. The error message indicates what went wrong

Use LSP diagnostics

The text editor shows compile-time errors inline:

  • Red underline: Error (won’t compile)
  • Yellow underline: Warning (compiles but suspicious)
  • Hover for error message and suggested fix

Write intermediate values

Write intermediate values to channels for debugging:

func debug_controller(value f64) f64 {
    error := value - setpoint

    // Write to channel for visibility
    debug_error = f"Error is: {error}"
    return error * gain
}

Monitor these channels in Console to trace data flow.

Common fixes

Table

Problem Fix
Type mismatch Add explicit cast: f64(x)
Undefined symbol Check spelling, verify channel exists
Wrong argument count Check function signature
Division by zero Add guard: if b != 0
Index out of bounds Add guard: if i < len(data)
Missing return Add return statement to all code paths