veryfront/errors

Import

ts
import {
  attachErrorToActiveSpan,
  attachErrorToSpan,
  cliErrorBoundary,
  cliErrorBoundarySync,
  createError,
  createErrorHandler,
} from "veryfront/errors";

Examples

Define and create a structured framework error

ts
import { defineError } from "veryfront/errors";

const INVALID_WIDGET = defineError({
  slug: "invalid-widget",
  category: "GENERAL",
  title: "Invalid widget",
  status: 400,
});
throw INVALID_WIDGET.create({ detail: "The widget id is malformed." });

Exports

Components

NameDescriptionSource
AGENT_CONTEXT_WINDOW_EXCEEDEDAn assembled request estimate or output request exceeds a served limit.source
AGENT_EMPTY_RESPONSEsource
AGENT_ERRORsource
AGENT_INTENT_ERRORsource
AGENT_NOT_FOUNDsource
AGENT_TIMEOUTsource
ALREADY_EXISTSWriting would replace something that is already there.source
API_CLIENT_ERRORAPI client request/response errors (replaces VeryfrontAPIError)source
API_ERRORsource
API_ROUTE_ERRORsource
ASSET_OPTIMIZATION_ERRORsource
AUTHENTICATION_REQUIREDsource
BRANCH_NOT_FOUNDsource
BUILD_ERROR_CATALOGsource
BUILD_FAILEDsource
BUNDLE_ERRORsource
CACHE_ERRORsource
CACHE_INVARIANT_VIOLATIONCache path invariant violations (replaces CacheInvariantError)source
CACHE_PATH_MISMATCHsource
CIRCUIT_BREAKER_OPENsource
CIRCULAR_DEPENDENCYsource
CLIENT_BOUNDARY_VIOLATIONsource
CLIENT_ONLY_IN_SERVERsource
COMPILATION_ERRORsource
COMPONENT_ERRORsource
CONFIG_ERROR_CATALOGsource
CONFIG_INVALIDsource
CONFIG_NOT_DEPLOYABLEThe project's configuration file uses a construct Veryfront Cloud's configuration evaluator can never accept, so the release would answer 500 to every request. Raised before a release is created; the detail names the file, the change that makes the project deployable, and the line when the evaluator located the construct it refused.source
CONFIG_NOT_FOUNDsource
CONFIG_PARSE_ERRORsource
CONFIG_TYPE_ERRORsource
CONFIG_VALIDATION_ERRORSchema-level config validation (e.g. Zod schema mismatch at runtime)source
CONFIG_VALIDATION_FAILEDConfig file validation failures (replaces ConfigValidationError)source
CORS_CONFIG_INVALIDsource
COST_LIMIT_EXCEEDEDsource
DEFAULT_MODEL_CREDENTIAL_MISMATCHThe default model's provider has no credential while a different provider does. Resolution stays deterministic rather than silently substituting whichever key happens to be present on this machine.source
DEPENDENCY_MISSINGsource
DEPENDENCY_SNAPSHOT_STORE_UNAVAILABLEsource
DEPLOYMENT_ERRORsource
DEPLOYMENT_ERROR_CATALOGsource
DEPLOYMENT_VERIFICATION_TIMEOUTsource
DEV_ERROR_CATALOGsource
DEV_SERVER_ERRORsource
DURABLE_RUN_EVENT_PERSISTENCE_FAILEDsource
DYNAMIC_ROUTE_ERRORsource
ENV_VAR_MISSINGsource
ENVIRONMENT_NOT_FOUNDsource
ENVIRONMENT_NOT_ROUTABLEsource
ERROR_CATALOGsource
ERROR_OVERLAY_ERRORsource
ERROR_REGISTRYCentral registry mapping every error slug to its definition. Assembled from the per-category registry fragments.source
ERROR_SOLUTIONSsource
ESM_CACHE_INIT_FAILEDsource
EVAL_INFERENCE_POLICY_DENIEDAn eval stopped because a provider-executed tool is not available under the project's EU-only inference policy.source
EVAL_MODEL_ACCESS_DENIEDAn eval stopped because the model gateway refused to serve its model requests for billing or entitlement reasons (HTTP 402). Every later record would fail the same way, so the run fails fast with one actionable error instead of grading empty outputs.source
EVAL_MODEL_EGRESS_BLOCKEDAn eval stopped because the host egress policy blocked its model gateway request: the Veryfront API host resolves to a private network address. The policy blocks every later record the same way.source
EVAL_MODEL_INFERENCE_POLICY_DENIEDAn eval stopped because the Veryfront Cloud gateway refused its model request under a model policy (account, project or API key). Every later record sends the same model and tools, so it is refused the same way.source
EVAL_MODEL_PROJECT_ACCESS_DENIEDAn eval stopped because the Veryfront Cloud gateway denied the credential access to the linked project (HTTP 403).source
EVAL_MODEL_SPEND_LIMIT_EXCEEDEDAn eval stopped because Veryfront reached its AI provider spend limit for the current window. Buying credits does not clear this limit.source
EVAL_MODEL_UNAUTHORIZEDAn eval stopped because the Veryfront Cloud gateway rejected the API credential for its model requests (HTTP 401).source
EVAL_PROJECT_REQUIREDAn eval stopped because the Veryfront Cloud gateway rejected its model requests for naming no project (HTTP 400, gateway_project_required).source
EVAL_RECORD_TIMEOUTAn eval record ran past its time limit. The limit covers the whole record: target execution, tools, model requests, metrics, and checks. A model stream that stops sending data after its response headers has no deadline of its own, so the record limit is what keeps an eval run from waiting forever.source
FALLBACK_EXHAUSTEDBoth primary and fallback operations failed (replaces FallbackExecutionError)source
FAST_REFRESH_ERRORsource
FILE_NOT_FOUNDsource
FILE_WATCH_ERRORsource
GENERAL_ERROR_CATALOGsource
HMR_ERRORsource
HYDRATION_MISMATCHsource
IMPORT_MAP_INVALIDsource
IMPORT_RESOLUTION_ERRORsource
INITIALIZATION_ERRORsource
INPUT_VALIDATION_FAILEDHTTP request input validation failures (replaces ValidationError)source
INVALID_ARGUMENTA value the caller supplied is not acceptable: a CLI flag, a positional argument, a config field, or a function argument. Exit code 2 is the CLI's "invalid usage" code, so a script can tell a typo from a failed run.source
INVALID_IMPORTsource
INVALID_ROUTE_FILEsource
INVALID_USE_CLIENTsource
INVALID_USE_SERVERsource
LAYOUT_NOT_FOUNDsource
LOCAL_INTEGRATION_CONFIG_INVALIDsource
LOCAL_INTEGRATION_CREDENTIAL_UNAVAILABLEsource
LOCAL_INTEGRATION_CREDENTIALS_MISSINGsource
LOCAL_INTEGRATION_REQUEST_FAILEDsource
LOCAL_INTEGRATION_REQUEST_INVALIDsource
LOCAL_INTEGRATION_RESPONSE_INVALIDsource
LOCKFILE_FORMAT_MISMATCHsource
LOCKFILE_READ_ERRORsource
MARKDOWN_COMPILE_ERRORsource
MDX_COMPILE_ERRORsource
MIDDLEWARE_ERRORsource
MODULE_ERROR_CATALOGsource
MODULE_NOT_FOUNDsource
NESTED_CWD_SCOPEA scope that owns the process working directory was opened inside another one.source
NETWORK_ERRORsource
NOT_SUPPORTEDsource
ORCHESTRATION_ERRORsource
PAGE_NOT_FOUNDsource
PERMISSION_DENIEDsource
PLATFORM_ERRORsource
PORT_IN_USEsource
PREVIEW_DEPLOYMENT_NOT_ALLOWEDVeryfront's managed Preview environment renders the latest source on the main branch. It has no release to swap, so the API refuses deployments to it.source
PREVIEW_HOSTNAME_TOO_LONGsource
PROBLEM_JSON_CONTENT_TYPEContent-Type header for RFC 9457 responsessource
PRODUCTION_BUILD_REQUIREDsource
PROJECT_EXECUTION_UNAVAILABLEsource
PROJECT_LINK_STALEThe local link in .veryfront/project.json names a project the control plane will not hand back. The link records no owning account, so a deleted project and one owned by a different account are indistinguishable here, so the CLI's detail names both. Reserved for the local link: any other project reference is misdirected by a suggestion to delete this file.source
PROJECT_SOURCE_EMPTYsource
PROVIDER_REPLAY_CHECKPOINT_INVALIDProvider replay checkpoint state failed validation at a consumer boundary. Replay state guards provider protocol correctness on resume, so malformed or unappliable state fails closed instead of degrading into an unsigned replay. Details never include checkpoint contents: provider blocks carry signed reasoning material that must stay out of logs and error text.source
PUSH_CONFLICTsource
PUSH_RECEIPT_MISSINGsource
RAG_STORE_CORRUPTPersisted RAG index is malformed or failed structural validation.source
RAG_STORE_UNAVAILABLEA persisted RAG index operation could not be completed safely.source
REDIRECT_DESTINATION_NOT_ALLOWEDsource
RELEASE_BUILD_TIMEOUTsource
RELEASE_MISSING_VERSIONsource
RELEASE_NOT_FOUNDProduction domain resolved but no active release foundsource
RENDER_ERRORsource
REQUEST_ERRORsource
RESOURCE_NOT_FOUNDsource
ROUTE_CONFLICTsource
ROUTE_ERROR_CATALOGsource
ROUTE_HANDLER_INVALIDsource
ROUTE_PARAMS_ERRORsource
RSC_ERROR_CATALOGsource
RSC_PAYLOAD_ERRORsource
RUNTIME_ERROR_CATALOGsource
SCHEDULE_CONFIG_INVALIDSchedule definition validation failures (required fields, cron, concurrencyPolicy, target)source
SECURITY_VIOLATIONPath traversal / secure-fs violations (replaces SecurityError)source
SEMAPHORE_TIMEOUTsource
SERVER_ERROR_CATALOGsource
SERVER_ONLY_IN_CLIENTsource
SERVER_START_ERRORsource
SERVICE_OVERLOADEDsource
SOURCE_DIGEST_MISMATCHsource
SOURCE_MAP_ERRORsource
SOURCE_SNAPSHOT_FRESHNESS_UNAVAILABLEsource
SOURCEMAP_ERRORsource
SSG_GENERATION_ERRORsource
SSR_OUTPUT_LIMIT_EXCEEDEDsource
SYNC_STATE_INVALIDsource
TEMPLATE_NOT_FOUNDveryfront init --template <name> (and npm create veryfront -- --template) was given a name that is not in the starter catalog. The detail carries the list of valid names so a wrong guess is self-correcting.source
TIMEOUT_ERRORsource
TOKEN_STORAGE_ERRORToken storage adapter failures (replaces TokenStorageError)source
TOOL_ID_CONFLICTsource
TRIGGER_CONFIG_INVALIDTrigger ID format and input serialization validation failuressource
TRIGGER_EXECUTION_FAILEDTrigger target task or workflow failed during local runsource
TRIGGER_NOT_SUPPORTEDTrigger target type is not supported in the current runtime contextsource
TRIGGER_TARGET_NOT_FOUNDTrigger target (task or workflow) not found during local runsource
TYPESCRIPT_ERRORsource
UNKNOWN_ERRORsource
VERSION_MISMATCHsource
WEBHOOK_CONFIG_INVALIDWebhook definition validation failures (required fields, target, eventFilter)source

Functions

NameDescriptionSource
attachErrorToActiveSpanAttach error to the currently active span (if any)source
attachErrorToSpanAttach error metadata to an OpenTelemetry spansource
cliErrorBoundaryCLI error boundary - wraps a handler function and catches errorssource
cliErrorBoundarySyncSynchronous version of CLI error boundarysource
createErrorsource
createErrorHandlerExpress/Hono-style error handler middleware factorysource
createErrorResponseCreate an RFC 9457 compliant error Responsesource
createErrorResponseFromDefinitionCreate an RFC 9457 error Response from a registered error definitionsource
createErrorScopeCreate a scoped error context helper for multiple related operationssource
createErrorSolutionsource
createProblemResponseCreate an RFC 9457 error Response from raw parameterssource
createSimpleErrorsource
defineErrorDefine an error in the registrysource
ensureErrorEnsure a value is an Error while preserving the established identity contract for ordinary Error instances.source
errorToResponseConvert any error to an RFC 9457 Responsesource
errorToRFC9457ResponseConvert any error to an RFC 9457 Response with environment-aware filteringsource
formatCLIErrorFormat any error for CLI outputsource
formatErrorLogLog format for errors (matches the plan's log format spec)source
formatUserErrorFormat error with plain text (existing behavior)source
fromErrorDecode legacy Veryfront error data attached by toError().source
getAllSlugsGet all registered slugssource
getErrorBySlugGet an error definition by slugsource
getErrorMessageExtract error message from any error typesource
getErrorsByCategoryGet all errors in a categorysource
getErrorSolutionsource
handleErrorWithFallbacksource
handleErrorWithFallbackSyncsource
httpErrorBoundaryWrap a handler with error boundary that catches all errors and converts them to RFC 9457 Problem Details responses.source
identifyErrorsource
isVeryfrontErrorCheck if an error is a VeryfrontError with slug-based identitysource
logErrorLog a VeryfrontError with structured formattingsource
logErrorWithMessageLog an error with a custom message prefixsource
retryWithBackoffsource
safeFileReadSafe file read with loggingsource
safeFileStatSafe file stat with loggingsource
safeReadDirSafe directory read with loggingsource
sanitizeTerminalDiagnosticTextPrepare one untrusted diagnostic field for terminal or plain-text output. Apply framework-owned ANSI styling only after this sanitizer returns.source
searchErrorssource
toErrorConvert a VeryfrontErrorData (plain object) to a throwable Error instance.source
withErrorContextExecute async operation with error logging and fallbacksource
withErrorContextSyncExecute sync operation with error logging and fallbacksource
wrapErrorHandlersource
wrapHandlerWithErrorBoundaryWrap a complete Handler object with error boundarysource
wrapUnknownErrorReturn a detached VeryfrontError, preserving safe identity fields from valid VeryfrontError inputssource
wrapWithContextWrap an error with additional contextsource

Classes

NameDescriptionSource
VeryfrontErrorVeryfront Error class with slug-based error identitysource

Types

NameDescriptionSource
ConfigContextsource
ErrorCatalogsource
ErrorCategoryError categories for domain-based grouping and handlingsource
ErrorContextsource
ErrorCreateOptionsOptions for creating an error instancesource
ErrorDefinitionError definition for the registrysource
ErrorHandlingOptionssource
ErrorLogEntrysource
ErrorSlugsource
ErrorSolutionsource
LogLevelsource
PartialErrorCatalogsource
RegisteredErrorRegistered error with factory methodsource
RetryWithBackoffOptionsOptions for retryWithBackoff. Every attempt value passed to fn and the hooks below is 0-based (first try = 0), including wrapFinalError's lastAttempt.source
RFC9457ResponseRFC 9457 Problem Details response shapesource
UserFriendlyErrorSolutionsource
VeryfrontErrorDataDiscriminated union for serializable error data.source
VeryfrontErrorOptionsOptions for VeryfrontError constructorsource

Deep imports

These import paths group focused functionality under this module. Each is a separate barrel; import only what you need.

veryfront/errors/general

ts
import { ALREADY_EXISTS, AUTHENTICATION_REQUIRED, FILE_NOT_FOUND } from "veryfront/errors/general";

Components

NameDescriptionSource
ALREADY_EXISTSWriting would replace something that is already there.source
AUTHENTICATION_REQUIREDsource
FILE_NOT_FOUNDsource
GENERAL_REGISTRYRegistry fragment for GENERAL errors (slug → definition).source
INITIALIZATION_ERRORsource
INPUT_VALIDATION_FAILEDHTTP request input validation failures (replaces ValidationError)source
INVALID_ARGUMENTA value the caller supplied is not acceptable: a CLI flag, a positional argument, a config field, or a function argument. Exit code 2 is the CLI's "invalid usage" code, so a script can tell a typo from a failed run.source
NESTED_CWD_SCOPEA scope that owns the process working directory was opened inside another one.source
NOT_SUPPORTEDsource
PERMISSION_DENIEDsource
PROJECT_SOURCE_EMPTYsource
RESOURCE_NOT_FOUNDsource
SECURITY_VIOLATIONPath traversal / secure-fs violations (replaces SecurityError)source
TIMEOUT_ERRORsource
UNKNOWN_ERRORsource

veryfront/errors/module

ts
import {
  CIRCULAR_DEPENDENCY,
  DEPENDENCY_MISSING,
  IMPORT_RESOLUTION_ERROR,
} from "veryfront/errors/module";

Components

NameDescriptionSource
CIRCULAR_DEPENDENCYsource
DEPENDENCY_MISSINGsource
IMPORT_RESOLUTION_ERRORsource
INVALID_IMPORTsource
LOCKFILE_FORMAT_MISMATCHsource
LOCKFILE_READ_ERRORsource
MODULE_NOT_FOUNDsource
MODULE_REGISTRYRegistry fragment for MODULE errors (slug → definition).source
VERSION_MISMATCHsource