Exceptions and error codes#

The classes of hydromodpy.core.exceptions all derive from HydroModPyError. Each one carries a code of the form HMPY.Exxx, a one-line title(), and to_dict(), which renders the failure as a typed problem object. A few errors are defined beside the code that raises them (last section), and some calls raise built-in exceptions such as FileNotFoundError. The hierarchy is at the top level of the package:

try:
    hmp.run("path/to/config.toml")
except hmp.ConfigError as err:
    print(err.code, err)   # HMPY.E100, or the code of a subclass

Catching a parent class catches its subclasses. The command line maps each class to an exit code: Exit codes. To look up a code you met, find its row in the table: HMPY.E405 is one row.

Hierarchy#

Codes#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E000HydroModPyError1Base class for all HydroModPy exceptions.core
HMPY.E001CommandUsageErrorHydroModPyError2The command line asks for something the command cannot do as written.project, cli, resultshmp.show(), hmp.status()
HMPY.E002NothingThereErrorHydroModPyError10What the command names is not there: a file, a run, a project, an index.results, solver, project, workflowhmp.stop()
HMPY.E003OldNameErrorHydroModPyError1A public name left before the first stable version, and it has no alias.__init__, core
HMPY.E100ConfigErrorHydroModPyError14Configuration loading, validation, or resolution failure.project, workflow, core, calibrationhmp.calibrate(), hmp.replay(), hmp.run()
HMPY.E101ConfigValidationErrorConfigError14The configuration document failed validation.calibration, config, schema, core
HMPY.E102ConfigMissingErrorConfigError14A required configuration section or key is missing.project, model, results, data
HMPY.E103ImplicitInferenceErrorConfigError14Data inference triggered a type not whitelisted in strict mode.-
HMPY.E104SchemaVersionTooNewErrorConfigError14TOML schema version is newer than the installed HydroModPy.-
HMPY.E105UnitAliasConflictConfigError14Duplicate / conflicting unit alias registration.-
HMPY.E106FrozenConfigErrorConfigError14A frozen copy of a configuration was asked to change.core
HMPY.E107BoundsErrorConfigError14A call stepped outside the hosts or roots its Bounds allow.core
HMPY.E108CredentialsErrorConfigError14A credentials file is read and refuses: absent, misplaced, or carrying a bad block.project
HMPY.E200DataErrorHydroModPyError16Input data loading, validation, or provenance failure.-
HMPY.E201DataContractViolationDataError16A dataset does not satisfy its declared contract.model, data, catchment, results
HMPY.E202DataCacheErrorDataError16Local cache corruption or inconsistency.data, workflow
HMPY.E203CacheCorruptionErrorDataCacheError16Cache hit with an invalid fingerprint or unreadable payload.core, data, project
HMPY.E204DataSourceErrorDataError16Remote data source (HTTP/FTP) refused or returned invalid data.data, core
HMPY.E205NetworkErrorDataSourceError16HTTP 5xx, 429, or timeout while fetching a remote dataset.core, project, data
HMPY.E206MissingForcingErrorDataError16Required climatic / hydrometric forcing is absent for the period.data, model
HMPY.E207DataRequestErrorDataError16A fetch request is malformed, before any source is asked to serve it.data, core, project
HMPY.E208DataCapabilityErrorDataError16The selected data source does not serve the requested option.data
HMPY.E209DataProductErrorDataError16What a source returned does not satisfy what it declared.data
HMPY.E210FrozenDataErrorDataCacheError16A frozen run asked the cache for something the lockfile does not pin.data, workflow
HMPY.E211JobInputNotFoundErrorDataError10A file the job request names is not on disk.data, catchment
HMPY.E300MeshErrorHydroModPyError1Mesh generation or consistency failure.workflow, solver, results, mesh
HMPY.E301MeshGenerationErrorMeshError1Mesh generator (gmsh / FloPy helper) failed to produce a valid mesh.mesh
HMPY.E302IncompatibleMeshErrorMeshError1Two meshes expected to be congruent are not.solver, results
HMPY.E303MeshRequestErrorMeshError1A mesh request or an engine name is malformed, before any engine builds it.mesh
HMPY.E400SolverErrorHydroModPyError15Solver execution failure.solverhmp.run()
HMPY.E401SolverDivergedErrorSolverError15Solver reported non-convergence.solver
HMPY.E402SolverTimeoutErrorSolverError15Solver exceeded the configured wall-clock budget.-
HMPY.E403SolverBinaryErrorSolverError15Solver binary missing, unreadable, or crashed before producing output.solver
HMPY.E404SolverMassBalanceErrorSolverError15Mass balance residual exceeds the acceptance threshold.-
HMPY.E405SolverInputErrorSolverError15Invalid or inconsistent package data passed to the solver.solver
HMPY.E406SolverEnvironmentErrorSolverError15Solver runtime environment (PATH, licences) is misconfigured.solver
HMPY.E407IncompatibleCapabilitiesErrorSolverError15Requested capability is not implemented by the selected solver.solver
HMPY.E408ObservableNotAvailableErrorSolverError15Solver adapter cannot produce the requested observable for this run.solver, project
HMPY.E500PipelineErrorHydroModPyError1Pipeline orchestration failure.workflow, cli, project, solverhmp.run()
HMPY.E501StepErrorPipelineErrorA pipeline step raised an unrecoverable error.workflow
HMPY.E502CheckpointErrorPipelineError1Checkpoint read/write failure.-
HMPY.E503LedgerErrorPipelineError1Pipeline ledger (run history) corruption or write conflict.-
HMPY.E504ResumeErrorPipelineError1Pipeline cannot resume (incompatible checkpoint / config drift).project, workflow, results
HMPY.E505ExtractErrorPipelineError1Result extraction failed after a successful solver run.solver, results, workflow
HMPY.E506ExportErrorPipelineError1Exporter (NetCDF / CSV / VTU / GeoTIFF) failed to serialize results.results, project, workflowhmp.export(), hmp.publish()
HMPY.E507WorkspaceLockedErrorPipelineError1A concurrent process holds the workspace lock.-
HMPY.E508JournalErrorPipelineError1Workflow journal write/read inconsistency.workflow
HMPY.E509ResumeIntegrityErrorResumeError1A completed-step artifact failed integrity verification on resume.workflow
HMPY.E510WorkflowDAGCycleErrorPipelineError1The workflow DAG declaration contains a dependency cycle.workflow
HMPY.E511FailedCasesErrorPipelineError23One or more cases of a launch failed; every case wrote its outcome.-
HMPY.E600CalibrationErrorHydroModPyError21Calibration loop failure.calibration, project, clihmp.calibrate()
HMPY.E601ObjectiveErrorCalibrationError21Objective function evaluation failure.calibration
HMPY.E602OptimizerErrorCalibrationError21Optimizer backend (CMA, Optuna, ...) raised an unrecoverable error.calibration
HMPY.E603UncertaintyNotAvailableErrorCalibrationError21The search ran, and what it produced cannot carry the width asked for.calibration
HMPY.E700DisplayErrorHydroModPyError1Figure rendering failure.display, project, workflow
HMPY.E701FigureNotFoundErrorDisplayError1Requested figure name is not registered.-
HMPY.E702BackendErrorDisplayError1Matplotlib / PyVista backend failure.-
HMPY.E800StorageErrorHydroModPyError1Catalog or Zarr storage failure.-
HMPY.E801CatalogErrorStorageError1DuckDB catalog failure.-
HMPY.E802ZarrStoreErrorStorageError1Zarr store read/write failure.-
HMPY.E803ReadOnlyErrorCatalogError13A write was attempted against a read-only catalog.results
HMPY.E804WriteConflictErrorCatalogError12A concurrent writer holds the catalog and a write cannot proceed.results, calibration, core, projecthmp.trash()
HMPY.E805CrossProjectsErrorCatalogError17An operation crossed project boundaries that must stay isolated.-
HMPY.E806BackupFailedErrorCatalogError18The pre-migration catalog backup could not be written.-
HMPY.E807MigrationFailedErrorCatalogError19A catalog schema migration failed to apply.-
HMPY.E808CatalogUnreadableErrorCatalogError22The catalog index file exists but DuckDB could not open it.core, results
HMPY.E809ImportConflictErrorCatalogError12An imported run or project is already in the catalog.project, results
HMPY.E824SchemaVersionMismatchErrorStorageError11A stored document carries no version, or one this version does not read.schema, core, results
HMPY.E900ResultsErrorHydroModPyError1Results / postprocessing failure.project
HMPY.E901UnknownFieldErrorResultsError1Requested field name is not registered in the canonical field registry.results
HMPY.E1000TerrainErrorHydroModPyError15Terrain engine failure.catchment
HMPY.E1001TerrainCapabilityErrorTerrainError15The selected terrain engine does not implement the requested option.-
HMPY.E1002TerrainProductErrorTerrainError15A terrain product does not satisfy what the member it is passed to needs.catchment
HMPY.E1003TerrainRequestErrorTerrainError15The request itself is malformed, before any engine is asked to serve it.-
HMPY.E1004EmptyCatchmentErrorTerrainProductError15An outlet delineated nothing at all.catchment
HMPY.E1100JobUsageErrorHydroModPyError2The job directory is not usable as the caller gave it.schema, project
HMPY.E1101CapabilityVersionMismatchErrorHydroModPyError11The request targets a different major version of the capability.schema

Defined beside the code that raises them#

These classes are defined beside the code that raises them, one table per module.

hydromodpy.calibration.metrics.gauge_snap#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E600 (inherited)GaugeSnapErrorCalibrationError21The snap radius reaches no cell but the one the gauge already sits in.calibration

hydromodpy.calibration.observations.network_source#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)UnresolvedObservedNetworkConfigError14A network output names a source this project cannot produce a network from.calibration

hydromodpy.calibration.parameter_resolution#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)UnresolvedParameterNameConfigError14A parameter names a quantity this project does not carry, or two of them.calibration

hydromodpy.calibration.runners.failure_watch#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E600 (inherited)EveryTrialFailedErrorCalibrationError21Every trial in a row failed, so the search has nothing to search.calibration

hydromodpy.config.loading#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)ConfigFileErrorConfigError14A configuration file, or a file of its base_config chain, cannot be read.config

hydromodpy.core.payload.install#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E809 (inherited)PayloadConflictErrorImportConflictError12A file or a station row of a package would replace another one; nothing was written.core

hydromodpy.core.runtime.interrupts#

CodeClassParentExit codeMeaningRaised inDocumented on
noneStopRequested130A stop asked through the flag of the run, raised so the stack unwinds.core
noneTerminationRequested130SIGTERM, raised so the stack unwinds.core

hydromodpy.core.site.config#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)GaugeConflictErrorConfigError14A station key names another station than [site] gauge.core, data

hydromodpy.core.time.selection#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E900 (inherited)TimeSelectionErrorResultsError1A time selector names no period of the run.core

hydromodpy.core.toml_io.merge#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)BaseConfigConflictConfigError14Two files of a base_config graph that do not inherit each other disagree on a key.-

hydromodpy.core.toml_io.paths#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)BareInputNameErrorConfigError14A config path is a bare file name and no file of that name is at the root.config, data
HMPY.E100 (inherited)UnknownPathErrorConfigError14A dotted key path names a key the schema or the document does not have.core

hydromodpy.core.units.physical_bounds#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E101 (inherited)PhysicalBoundsErrorConfigValidationError14A value lies outside the physical range of its parameter.core

hydromodpy.core.workspace.exceptions#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)WorkspaceErrorConfigError14Raised when no HydroModPy workspace can be located for a given TOML.-

hydromodpy.data.ingest.raster#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E200 (inherited)RasterConversionErrorDataError16Raised when a raster file cannot be converted to COG.data

hydromodpy.data.ingest.tables#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E201 (inherited)TimeSeriesValidationErrorDataContractViolation16Raised when a CSV file fails validation.data

hydromodpy.data.ingest.vector#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E200 (inherited)VectorConversionErrorDataError16Raised when a vector file cannot be converted.data

hydromodpy.data.sites.catalog#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E809 (inherited)SiteConflictErrorImportConflictError12A site to add takes a declared name, or an outlet too close to another site.data

hydromodpy.data.sites.single_site#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)SiteMismatchErrorConfigError14The site named by the project is another catchment in the catalog.data

hydromodpy.data.variables.dem.apis.geoplateforme_download#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E204 (inherited)GeoPlateformeDownloadErrorDataSourceError16Raised when Geoplateforme discovery or download fails.data

hydromodpy.display.subject#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E700 (inherited)FigureNotApplicableDisplayError1A figure, or one of its panels, cannot be drawn from this subject.display

hydromodpy.model.forcing.sources#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E201 (inherited)ForcingGridErrorDataContractViolation16A gridded forcing with no pixel, or with no X and Y axis to read it by.model

hydromodpy.project.compare#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E900 (inherited)ComparisonCaseErrorResultsError1The runs cannot be compared, and the message says why.projecthmp.compare()
HMPY.E900 (inherited)ComparisonReferenceErrorResultsError1A reference names no sealed run.projecthmp.compare()

hydromodpy.project.data_cache#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)FrozenVerificationErrorConfigError14Raised when --frozen finds a lockfile drift before running anything.project

hydromodpy.project.exchange.replay#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)ReplayInputErrorConfigError14An input of a published copy is missing from inputs/ or has another digest.project

hydromodpy.project.launch.lease#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E804 (inherited)LeaseHeldErrorWriteConflictError12Another launcher holds the project and its death is not proven.project

hydromodpy.project.launch.plan#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)BudgetErrorConfigError14The plan asks for more than the machine, or the measurements, allow.project
HMPY.E100 (inherited)CellErrorConfigError14A cell cannot be read by the type of the key it is bound to.project
HMPY.E100 (inherited)PlanErrorConfigError14The plan cannot be written: its issues, one line each.project
HMPY.E100 (inherited)RunningCaseErrorConfigError14A case of the current plan is running; a new plan would change its ground.project
HMPY.E100 (inherited)SitesProjectErrorConfigError14The file is not a [sites] project, or a table or a bind line is unusable.project

hydromodpy.project.launch.summary_tables#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)SummaryErrorConfigError14[sites.summary] or [[sites.export]] asks for something the collect cannot give.project

hydromodpy.results.catalog.constants#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E900 (inherited)UnrankedMetricErrorResultsError1Raised when a metric has no declared direction, so best is undefined.results

hydromodpy.results.catalog.discovery#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E002SimulationNotFoundErrorReferenceResolutionError10Raised when a reference does not match any run or session.results, projecthmp.status(), hmp.trash()
HMPY.E801 (inherited)AmbiguousReferenceErrorReferenceResolutionError20Raised when a reference matches more than one run or session.results
HMPY.E801 (inherited)ReferenceResolutionErrorCatalogError1Base class for catalog reference resolution failures.-

hydromodpy.results.catalog.registration#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E804 (inherited)NameTakenErrorWriteConflictError12A name is held by a live directory, a trashed one or a tombstone.results
HMPY.E804 (inherited)VersionPairingErrorWriteConflictError12The run directory a session is paired with is already taken.results

hydromodpy.results.errors#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E801 (inherited)SeveralCasesErrorCatalogError1A session of several cases was asked for the one run or the one case it does not have.calibration, results
HMPY.E821FieldNotFoundErrorCatalogError1A field name is registered but absent from the simulation store.results
HMPY.E822RunNotFoundErrorCatalogError1A sim_id does not exist in the catalog.results
HMPY.E823ProjectNotFoundErrorCatalogError10A project root or its project.toml is missing.-
HMPY.E825RunNotSealedErrorCatalogError10A run has no manifest.json: it never completed, so it has no seal to read.resultshmp.open()

hydromodpy.results.export.publish#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E506 (inherited)MissingInputErrorExportError1An input of a run is not on disk any more, so a copy cannot carry its bytes.project, results

hydromodpy.results.plan_store#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E000 (inherited)PlanConflictErrorHydroModPyError1A plan with this hash exists and holds other content.results

hydromodpy.results.record.replay_class#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E900 (inherited)ReplayDeviationErrorResultsError1A replay asked to be strict did not reproduce the sealed values.results

hydromodpy.results.run.point#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E900 (inherited)PointOutsideMeshErrorResultsError1The requested coordinates fall outside the simulation mesh.results

hydromodpy.results.run.sealed#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E200 (inherited)MixedWindowsErrorDataError16Scores computed under different rules were about to be ranked together.results

hydromodpy.results.run.sealed_facts#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E200 (inherited)UnreadableManifestErrorDataError16A sealed run or session whose seal does not read under this version.project, results

hydromodpy.results.storage.attempt#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E804 (inherited)AttemptClaimedErrorWriteConflictError12Another worker claimed the same attempt of this case first.results
HMPY.E804 (inherited)CaseAliveErrorWriteConflictError12The case is running elsewhere and its death is not proven.results
HMPY.E804 (inherited)DirectoryWithoutOutcomeErrorWriteConflictError12The latest directory of the case carries no outcome and no seal.results

hydromodpy.results.trash#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E804 (inherited)DirectoryInUseErrorWriteConflictError12The directory belongs to an attempt that is running, or may still be.results
HMPY.E804 (inherited)ProtectedDirectoryErrorWriteConflictError12The directory carries the protected tag and the caller did not force.cli, results

hydromodpy.workflow.dispatch#

CodeClassParentExit codeMeaningRaised inDocumented on
HMPY.E100 (inherited)WorkflowErrorConfigError14Base class for workflow-dispatch errors.-
HMPY.E100 (inherited)WorkflowMismatchErrorWorkflowError14The requested workflow and the one the file declares disagree.workflow
HMPY.E100 (inherited)WorkflowUnknownErrorWorkflowError14The file declares a workflow mode that does not exist.workflow