Skip to main content
This page documents all error codes and messages you may encounter when interacting with the Newton Protocol Gateway, SDK, and smart contracts.

JSON-RPC Standard Errors

CodeMessageDescription
-32700Parse errorInvalid JSON in request body
-32600Invalid requestRequest does not conform to JSON-RPC 2.0
-32601Method not foundUnknown RPC method name
-32602Invalid paramsMissing or invalid method parameters
-32603Internal errorUnexpected server-side error

Newton-Specific Error Codes

CodeNameDescriptionResolution
-32615PolicyEvaluationErrorRego policy evaluation failedCheck Rego syntax, verify data.data and data.params are populated correctly
-32616ContractErrorSmart contract interaction failedVerify contract addresses are correct and contracts are deployed
-32617OperatorNotRegisteredCalling operator is not registered with the AVSEnsure operator registration is complete
-32618IncompatiblePolicyVersionPolicy version mismatch between client and protocolRun newton-cli version check-compatibility and migrate if needed
-32619IncompatiblePolicyDataVersionPolicyData version mismatchRedeploy PolicyData with compatible version
-32620DataProviderErrorWASM oracle execution failedCheck WASM binary, verify secrets and wasm_args

Gateway Error Messages

Error MessageCauseResolution
"Unknown Newton RPC method: {method}"Typo in method nameVerify method spelling against RPC API
"Invalid request format: {details}"Malformed request parametersReview parameter types and required fields
"RpcRead permission required"API key lacks read permissionUse key with rpc_read or rpc permission
"RpcWrite permission required"API key lacks write permissionUse key with rpc_write or rpc permission
"Invalid API key"API key is invalid or expiredVerify key or create a new one via Dashboard
"policy_client is owned by another user"On-chain owner does not match API key holderUse API key associated with the on-chain getOwner() address
"policy client has no owner"Contract returned zero address for getOwner()Verify contract is initialized with an owner
"Missing secrets for N PolicyData contract(s)"Secrets not uploaded for PolicyData contractsUpload secrets via newt_storeEncryptedSecrets
"No secrets found for policy_client ... and policy_data..."No secrets stored for this client/data pairUpload secrets or use newt_simulatePolicyData with inline secrets
"Secrets upload validation failed: {details}"Secrets JSON does not match on-chain schemaFix secrets format to match secretsSchemaCid schema
"WASM execution failed: {details}"WASM oracle runtime errorCheck WASM binary, inputs, and wasm_args
"Rego evaluation failed: {details}"Policy syntax or runtime errorFix Rego code, test with newton-cli regorus eval
"Contract read failed: {details}"On-chain contract read failedVerify contract addresses and chain connectivity
"Task timeout"BLS aggregation exceeded timeoutIncrease timeout parameter or retry
"No operators available"No registered operators onlineRetry later; check network status
"TaskAlreadyExists"Duplicate task submissionUse a different nonce or wait for existing task
"BlockNumberTooRecent"Reference block too close to currentWait a few blocks before submitting

On-Chain Errors

ErrorContractCauseResolution
InvalidAttestation()PolicyClientBLS signature verification failedVerify Task Manager address, check attestation expiration
ExecutionFailed()PolicyClientInner transaction call revertedDebug the target transaction independently
IncompatiblePolicyVersionNewtonPolicyPolicy factory version below TaskManager’s minCompatiblePolicyVersionDeploy new policy via latest factory, call setPolicyAddress(newPolicy). See Version Compatibility
PolicyClientNotRegisteredPolicyClientRegistryClient not registered or has been deactivatedRegister via registerClient() or CLI: newton-cli policy-client register. See PolicyClientRegistry
PolicyNotSetPolicyClient_setPolicy() called before policy address is setCall _setPolicyAddress() or setPolicyAddress() first
Not authorized intent senderPolicyClientmsg.sender does not match attestation.intent.fromEnsure the user who signed the intent is the transaction sender
Chain ID does not matchPolicyClientAttestation was created for a different chainVerify the intent specifies the correct chainId
Attestation expiredTaskManagerblock.number >= attestation.expirationRequest a new attestation; consider increasing expireAfter in policy config
Attestation already spentTaskManagerAttestation has already been usedEach attestation is single-use; request a new one
InterfaceNotSupportedPolicyClientContract does not implement IERC165 correctlyOverride supportsInterface and call super.supportsInterface(interfaceId)

SDK Error Codes

CodeDescription
INVALID_PARAMSInvalid parameters passed to SDK method
TIMEOUTRequest exceeded timeout threshold
NETWORK_ERRORNetwork connectivity issue
CONTRACT_ERROROn-chain contract interaction failed
GATEWAY_ERRORNewton Gateway returned an error
UNKNOWNUnexpected error
import { SDKError, SDKErrorCode } from '@magicnewton/newton-protocol-sdk';

try {
  await walletClient.evaluateIntentDirect(request);
} catch (error) {
  if (error instanceof SDKError) {
    switch (error.code) {
      case SDKErrorCode.TIMEOUT:
        // Increase timeout or retry
        break;
      case SDKErrorCode.GATEWAY_ERROR:
        // Check API key and Gateway connectivity
        break;
    }
  }
}

HTTP Status Codes

StatusDescription
200Success (check JSON-RPC result for application-level errors)
401Unauthorized — invalid API key
403Forbidden — insufficient permissions
429Too Many Requests — rate limited
500Internal Server Error
502Bad Gateway — service unavailable

Diagnostic Tools

  • newton-cli regorus eval — test Rego policies locally with Newton crypto extensions
  • newton-cli policy simulate — test full policy evaluation locally
  • newton-cli policy-data simulate — test WASM oracle execution locally
  • newt_simulatePolicy — test policy evaluation via the Gateway
  • newt_simulatePolicyData — test WASM execution via the Gateway
  • Newton Explorer — view task status and evaluation results