{"record":{"id":"dac574dada473794","repo":"can1357/oh-my-pi","slug":"title-is-required-unless-fill-is-true","errorCode":null,"errorMessage":"title is required unless fill is true","messagePattern":"title is required unless fill is true","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/gh-pr-checkout.ts","lineNumber":588,"sourceCode":"\nexport async function executePrCreate(\n\tsession: ToolSession,\n\tparams: GithubInput,\n\tsignal: AbortSignal | undefined,\n): Promise<AgentToolResult<GhToolDetails>> {\n\tconst repo = normalizeOptionalString(params.repo);\n\tconst title = normalizeOptionalString(params.title);\n\tconst body = params.body;\n\tconst base = normalizeOptionalString(params.base);\n\tconst head = normalizeOptionalString(params.head);\n\tconst draft = params.draft ?? false;\n\tconst fill = params.fill ?? false;\n\tconst reviewers = normalizePrIdentifierList(params.reviewer);\n\tconst assignees = normalizePrIdentifierList(params.assignee);\n\tconst labels = normalizePrIdentifierList(params.label);\n\n\tif (!fill && !title) {\n\t\tthrow new ToolError(\"title is required unless fill is true\");\n\t}\n\tif (fill && (title || body !== undefined)) {\n\t\tthrow new ToolError(\"fill is mutually exclusive with title and body\");\n\t}\n\n\tconst args = [\"pr\", \"create\"];\n\tappendRepoFlag(args, repo);\n\tif (title) args.push(\"--title\", title);\n\tif (base) args.push(\"--base\", base);\n\tif (head) args.push(\"--head\", head);\n\tif (draft) args.push(\"--draft\");\n\tif (fill) args.push(\"--fill\");\n\tfor (const reviewer of reviewers) args.push(\"--reviewer\", reviewer);\n\tfor (const assignee of assignees) args.push(\"--assignee\", assignee);\n\tfor (const label of labels) args.push(\"--label\", label);\n\n\tlet bodyDir: string | undefined;\n\ttry {","sourceCodeStart":570,"sourceCodeEnd":606,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/gh-pr-checkout.ts#L570-L606","documentation":"The PR creation flow (gh pr create) requires either an explicit title/body or the --fill flag, which derives them from commit messages. If no title was supplied and fill was not set to true, the tool throws before invoking gh, because GitHub requires a title and the tool refuses to invent one.","triggerScenarios":"Calling the pr_create op with no `title` parameter and `fill` omitted/false — e.g. providing only base/label/reviewer parameters, or forgetting that fill defaults to false.","commonSituations":"Automated scripts that pass reviewers/labels but forget the title; users expecting gh's default behavior of filling from commits without setting fill=true.","solutions":["Add a title (and optionally body) to the pr_create parameters.","Set `fill: true` to derive title and body from the branch's commit messages.","Check that the title parameter is actually being passed by your wrapper/script — an empty string is treated as absent."],"exampleFix":"// before\nop pr_create --base main\n// after\nop pr_create --base main --title \"Fix login redirect\" --body \"Fixes #42\"\n// or\nop pr_create --base main --fill","handlingStrategy":"validation","validationCode":"if (!params.fill && !(typeof params.title === \"string\" && params.title.trim())) {\n  throw new Error(\"pr_create requires a title, or fill=true to derive one from commits\");\n}","typeGuard":"function canCreatePr(p: { title?: string; fill?: boolean }): p is { title: string; fill?: boolean } {\n  return Boolean(p.fill) || (typeof p.title === \"string\" && p.title.trim().length > 0);\n}","tryCatchPattern":"try {\n  await op.prCreate(params);\n} catch (err) {\n  if (err instanceof ToolError && err.message === \"title is required unless fill is true\") {\n    await op.prCreate({ ...params, fill: true });\n  } else throw err;\n}","preventionTips":["Always set title (or fill=true) in pr_create call templates.","Trim titles — whitespace-only is effectively absent.","In automation, default to fill:true when no human wrote a title.","Centralize pr_create invocation so the title requirement is enforced in one place."],"tags":["validation","pr-create","github-cli"],"backgroundTag":"missing-required-parameter","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}