{"record":{"id":"6479ea2bb109be0f","repo":"Comfy-Org/ComfyUI","slug":"solver-type-must-be-phi-1-or-phi-2","errorCode":null,"errorMessage":"solver_type must be 'phi_1' or 'phi_2'","messagePattern":"solver_type must be 'phi_1' or 'phi_2'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/k_diffusion/sampling.py","lineNumber":1597,"sourceCode":"                    # Stage 3\n                    s_u = torch.sum((lambda_pos - er_lambda_s) / scaled_pos) * lambda_step_size\n                    denoised_u = (denoised_d - old_denoised_d) / ((er_lambda_s - er_lambdas[i - 2]) / 2)\n                    x = x + alpha_t * ((dt ** 2) / 2 + s_u * noise_scaler(er_lambda_t)) * denoised_u\n                old_denoised_d = denoised_d\n\n            if s_noise > 0:\n                x = x + alpha_t * noise_sampler(sigmas[i], sigmas[i + 1]) * s_noise * (er_lambda_t ** 2 - er_lambda_s ** 2 * r ** 2).sqrt().nan_to_num(nan=0.0)\n        old_denoised = denoised\n    return x\n\n\n@torch.no_grad()\ndef sample_seeds_2(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, r=0.5, solver_type=\"phi_1\"):\n    \"\"\"SEEDS-2 - Stochastic Explicit Exponential Derivative-free Solvers (VP Data Prediction) stage 2.\n    arXiv: https://arxiv.org/abs/2305.14267 (NeurIPS 2023)\n    \"\"\"\n    if solver_type not in {\"phi_1\", \"phi_2\"}:\n        raise ValueError(\"solver_type must be 'phi_1' or 'phi_2'\")\n\n    extra_args = {} if extra_args is None else extra_args\n    seed = extra_args.get(\"seed\", None)\n    noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler\n    s_in = x.new_ones([x.shape[0]])\n\n    model_sampling = model.inner_model.model_patcher.get_model_object('model_sampling')\n    s_noise = s_noise * getattr(model_sampling, \"noise_scale\", 1.0)\n    inject_noise = eta > 0 and s_noise > 0\n    sigma_fn = partial(half_log_snr_to_sigma, model_sampling=model_sampling)\n    lambda_fn = partial(sigma_to_half_log_snr, model_sampling=model_sampling)\n    sigmas = offset_first_sigma_for_snr(sigmas, model_sampling)\n\n    fac = 1 / (2 * r)\n\n    for i in trange(len(sigmas) - 1, disable=disable):\n        denoised = model(x, sigmas[i] * s_in, **extra_args)\n        if callback is not None:","sourceCodeStart":1579,"sourceCodeEnd":1615,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/k_diffusion/sampling.py#L1579-L1615","documentation":"Raised by sample_seeds_2 (SEEDS-2 stochastic explicit exponential derivative-free solver) when solver_type is not one of its two implemented variants 'phi_1' or 'phi_2', which select different exponential-integrator basis functions. Exact string membership test at function entry.","triggerScenarios":"Calling sample_seeds_2(..., solver_type='phi1') (missing underscore), 'PHI_1' (case), or a DPM++ value like 'midpoint' copy-pasted from another sampler's options.","commonSituations":"Custom sampler option lists shared across samplers; hand-edited workflow JSON; scripts forwarding one generic solver_type setting to many samplers.","solutions":["Pass solver_type='phi_1' (default) or 'phi_2'","Keep per-sampler option lists separate instead of one shared combo","Validate/normalize solver strings (lowercase, strip) before dispatch"],"exampleFix":"# before\nsample_seeds_2(model, x, sigmas, solver_type='phi1')\n# after\nsample_seeds_2(model, x, sigmas, solver_type='phi_1')","handlingStrategy":"validation","validationCode":"solver_type = solver_type.strip().lower()\nassert solver_type in {'phi_1', 'phi_2'}, \"solver_type must be 'phi_1' or 'phi_2'\"","typeGuard":"def is_valid_seeds_solver(s: str) -> bool:\n    return s in {'phi_1', 'phi_2'}","tryCatchPattern":null,"preventionTips":["Keep per-sampler solver option lists; do not share one combo across samplers","Validate strings at the API boundary before building the sampler call"],"tags":["sampling","seeds","solver-type","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}