Skip to content

fix(reliability): SystemExit on malformed .param files kills entire GUI with no recovery #1416

@yashhzd

Description

@yashhzd

Description

ParDict.load_param_file_into_dict() and ParDict.__process_parameter_line() raise SystemExit on any malformed parameter file (invalid name, duplicate parameter, non-finite value, encoding error, etc.).

SystemExit bypasses except Exception handlers, which means any caller wrapping the load in a try/except will still see their GUI application terminated immediately. Users lose unsaved work with no opportunity to fix the file or skip the bad parameter.

Affected Code

data_model_par_dict.py — 7 separate raise SystemExit(msg) calls:

  • Line 162: Missing parameter-value separator
  • Line 171: Non-UTF-8 encoding
  • Line 188: Parameter name too long
  • Line 193: Invalid parameter name characters
  • Line 198: Duplicated parameter
  • Line 205: Non-finite value (inf, nan)
  • Line 211: Invalid parameter value (not a number)
  • Line 276: Unsupported file format

Impact

Combined with non-atomic file writes (direct write to target file, no temp+rename), a power loss during a parameter write can corrupt the file. On next startup, the corrupted file triggers SystemExit, preventing the app from ever opening again (crash loop).

Proposed Fix

Replace SystemExit with a custom exception (e.g., ParamFileError(ValueError)) that callers can catch with standard except Exception or except ValueError. This allows the GUI to show an error dialog and let the user fix or skip the problematic file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions