{"record":{"id":"9e86205af7451485","repo":"Stability-AI/generative-models","slug":"cannot-find","errorCode":null,"errorMessage":"Cannot find {}","messagePattern":"Cannot find (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"main.py","lineNumber":561,"sourceCode":"    # running as `python main.py`\n    # (in particular `main.DataModuleFromConfig`)\n    sys.path.append(os.getcwd())\n\n    parser = get_parser()\n\n    opt, unknown = parser.parse_known_args()\n\n    if opt.name and opt.resume:\n        raise ValueError(\n            \"-n/--name and -r/--resume cannot be specified both.\"\n            \"If you want to resume training in a new log folder, \"\n            \"use -n/--name in combination with --resume_from_checkpoint\"\n        )\n    melk_ckpt_name = None\n    name = None\n    if opt.resume:\n        if not os.path.exists(opt.resume):\n            raise ValueError(\"Cannot find {}\".format(opt.resume))\n        if os.path.isfile(opt.resume):\n            paths = opt.resume.split(\"/\")\n            # idx = len(paths)-paths[::-1].index(\"logs\")+1\n            # logdir = \"/\".join(paths[:idx])\n            logdir = \"/\".join(paths[:-2])\n            ckpt = opt.resume\n            _, melk_ckpt_name = get_checkpoint_name(logdir)\n        else:\n            assert os.path.isdir(opt.resume), opt.resume\n            logdir = opt.resume.rstrip(\"/\")\n            ckpt, melk_ckpt_name = get_checkpoint_name(logdir)\n\n        print(\"#\" * 100)\n        print(f'Resuming from checkpoint \"{ckpt}\"')\n        print(\"#\" * 100)\n\n        opt.resume_from_checkpoint = ckpt\n        base_configs = sorted(glob.glob(os.path.join(logdir, \"configs/*.yaml\")))","sourceCodeStart":543,"sourceCodeEnd":579,"githubUrl":"https://github.com/Stability-AI/generative-models/blob/e8cd657656fa5d61688191730d0e03242bf4ed44/main.py#L543-L579","documentation":"After passing the mutual-exclusion check, main.py verifies that the path given to -r/--resume actually exists on disk. If os.path.exists(opt.resume) is False it raises this ValueError before attempting to load anything, so a typo or moved checkpoint fails fast instead of deep inside checkpoint loading.","triggerScenarios":"Running with `-r /path/to/ckpt` where that path does not exist: checkpoint deleted or moved, wrong relative path from the launch working directory, or a container/mount that does not include the logs directory.","commonSituations":"Resuming after logs were archived or renamed; running from a different working directory so a relative path no longer resolves; submitting a SLURM/K8s job without mounting the volume holding the checkpoint; trailing whitespace or shell variable left empty in the path.","solutions":["Run `ls <path>` to verify the checkpoint path exists and correct the -r/--resume argument.","Use an absolute path for --resume, or launch from the same working directory used originally.","In containers/cluster jobs, mount or copy the directory containing the checkpoint and point --resume at the mounted path."],"exampleFix":"// before\npython main.py --base cfg.yaml -r logs/run1/checkpoints/last.ckpt   # run1 was renamed\n// after\npython main.py --base cfg.yaml -r logs/run1_renamed/checkpoints/last.ckpt","handlingStrategy":"validation","validationCode":"import os, sys\nresume = next((sys.argv[i+1] for i, a in enumerate(sys.argv) if a in ('-r', '--resume')), None)\nif resume and not os.path.exists(resume):\n    raise SystemExit(f\"Checkpoint not found: {os.path.abspath(resume)}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass absolute checkpoint paths to --resume.","Verify the checkpoint path exists (os.path.exists) before submitting cluster jobs.","Mount the logs volume in containers before resuming."],"tags":["filesystem","cli","path-validation"],"backgroundTag":"file-not-found","analyzedSha":"e8cd657656fa5d61688191730d0e03242bf4ed44","analyzedAt":"2026-08-29T11:23:43.234Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}