{"record":{"id":"42b063d161e413b3","repo":"can1357/oh-my-pi","slug":"arm-req-arm-already-exists-in-experimentid","errorCode":null,"errorMessage":"arm '${req.arm}' already exists in '${experimentId}'","messagePattern":"arm '(.+?)' already exists in '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/server.ts","lineNumber":164,"sourceCode":"\t// Exact task sample: prefer the intended include list, else observed trial\n\t// tasks. Trial task names are stored bare, while org-prefixed datasets\n\t// (e.g. \"swe-bench/swe-bench-verified\") address tasks as \"<org>/<task>\" —\n\t// re-derive the prefix for the fallback.\n\tlet include = req.include && req.include.length > 0 ? req.include : strings(cfg.include);\n\tif (include.length === 0) {\n\t\tconst org = template.dataset.includes(\"/\") ? `${template.dataset.split(\"/\", 1)[0]}/` : \"\";\n\t\tinclude = [\n\t\t\t...new Set(\n\t\t\t\tstore\n\t\t\t\t\t.listTraces(template.jobName)\n\t\t\t\t\t.map(t => t.task)\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.map(task => (task.includes(\"/\") ? task : `${org}${task}`)),\n\t\t\t),\n\t\t];\n\t}\n\tconst jobName = `${experimentId}-${req.arm}`;\n\tif (store.getRun(jobName)) throw new Error(`arm '${req.arm}' already exists in '${experimentId}'`);\n\tconst conditions = strings(cfg.conditions);\n\treturn {\n\t\tbenchmark: template.benchmark,\n\t\tmodel: req.model,\n\t\tdataset: template.dataset,\n\t\tinclude: include.length > 0 ? include : undefined,\n\t\ttasks: include.length > 0 ? include.length : numberOr(cfg.tasks),\n\t\tconcurrency: numberOr(cfg.concurrency),\n\t\ttimeoutMultiplier: numberOr(cfg.timeoutMultiplier),\n\t\tattempts: numberOr(cfg.attempts),\n\t\tagent: str(cfg.agent),\n\t\twebSearch: cfg.webSearch === true || undefined,\n\t\tprebuiltBinaries: cfg.prebuiltBinaries === true || undefined,\n\t\tconditions: conditions.length > 0 ? conditions : undefined,\n\t\tjobName,\n\t\tprewalk: req.prewalk,\n\t\trole: req.role,\n\t\tnote: req.note,","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/server.ts#L146-L182","documentation":"Each arm's job name is `<experimentId>-<arm>`, and the run store enforces uniqueness via store.getRun(jobName). This error means a run with that exact job name already exists, i.e. an arm with this name has already been added to the experiment. Arms are immutable labels — re-adding would collide with the existing run's directory and records.","triggerScenarios":"Calling addArm twice with the same arm name for the same experiment; re-running an idempotent-looking script that previously created the arm; a previous failed launch that still registered the run.","commonSituations":"Replaying a bootstrap script after partial failure; copy-pasting addArm calls with identical arm names; wanting to re-run an arm with a new model but reusing its old name.","solutions":["Use a new, unique arm name (e.g. append a version suffix: 'baseline-v2').","Check existing runs first and skip the call if store.getRun(`${experimentId}-${arm}`) returns a run.","If the old arm's run is stale/unwanted and the API supports it, remove or archive that run before re-adding.","Make batch scripts idempotent by filtering out arm names already present in the store."],"exampleFix":"// before\nserver.addArm(\"myexp\", { arm: \"baseline\", model: \"m2\" }); // second call\n// after\nconst arm = existing.has(\"myexp-baseline\") ? \"baseline-v2\" : \"baseline\";\nserver.addArm(\"myexp\", { arm, model: \"m2\" });","handlingStrategy":"validation","validationCode":"const jobName = `${experimentId}-${req.arm}`;\nif (store.getRun(jobName)) {\n  console.warn(`arm '${req.arm}' already present; skipping`);\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  server.addArm(expId, req);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"already exists\")) {\n    req.arm = `${req.arm}-${Date.now().toString(36)}`;\n    server.addArm(expId, req);\n  } else throw err;\n}","preventionTips":["Make bootstrap scripts idempotent: check store.getRun(`${expId}-${arm}`) before adding.","Version arm names (baseline-v1, baseline-v2) instead of reusing names for new configs.","Track created arms in your own manifest to avoid duplicate calls on retries.","On partial script failure, resume from a checkpoint rather than replaying all addArm calls."],"tags":["duplicate","naming","state-conflict"],"backgroundTag":"duplicate-resource-name","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}