Back to Webhook Messages
Webhook Messages

Invalid Formula Runtime

A formula could not be evaluated. Check for division by zero, incompatible types, invalid math function arguments, or an unsupported integer passed to round() as a rounding mode (use rounding.* names or integers 1–8). See invalid-formula-runtime in the reference manual.

The formula parsed successfully but failed during evaluation. Common causes:

  • Division by zero (or an operation that PHP rejects for the types involved).
  • Type mismatches for an operator (for example invalid use of arithmetic on non-numeric values after coercion).
  • Invalid math function arguments — wrong count or type passed to abs, ceil, floor, max, min, or round.
  • Unsupported rounding mode integer — the third argument to round() must be a rounding.* property or an integer from 1 to 8. Other integers (for example 99) are rejected.

Runtime failures occur after references resolve; if a field name is wrong, you may get invalid formula reference instead.

Typical error details (webhook log)

The formula in field limitPrice failed to evaluate. Check for issues like division by zero or incompatible types.

The formula in field x calls abs() with an invalid value. Expected a number, but got a string.

The formula in field x passes 99 as a rounding mode to round(), which is not supported. Use a rounding.* name (for example rounding.halfEven) or an integer from 1 to 8.

Incorrect (division by zero)

{
  "ticker": "SPY",
  "action": "buy",
  "qty": "0",
  "x": "=1 / signal.qty"
}

Fix — guard with a conditional or send a non-zero literal

{
  "ticker": "SPY",
  "action": "buy",
  "qty": "10",
  "x": "=1 / signal.qty"
}

Or use a ternary (for example default to 0 when signal.qty == 0) so the divisor is never zero.

Incorrect (invalid rounding mode integer)

{
  "ticker": "SPY",
  "action": "buy",
  "x": "=round(2.5, 0, 99)"
}

Use a named mode:

{
  "ticker": "SPY",
  "action": "buy",
  "value": "2.5",
  "x": "=round(signal.value, 0, rounding.halfEven)"
}

Incorrect (incompatible types for the operation)

Ensure numeric strings are valid numbers (commas in numbers are stripped the same way as elsewhere in signal parsing). Boolean coercion recognizes true / false string literals.

Adjust the expression or the payload values, then resend the webhook. See invalid formula syntax for allowed functions and invalid formula reference for rounding mode names.

Ready to put Invalid Formula Runtime to work?

Free 7-day trial

Set-up in 3 minutes

Paper account for testing

By continuing, you agree to the TradersPost Terms of Service and Privacy Policy. This site is protected by reCAPTCHA.