{"record":{"id":"01f8c6a05217bc81","repo":"can1357/oh-my-pi","slug":"cannot-determine-repository-name-from-dataset-sour","errorCode":null,"errorMessage":"Cannot determine repository name from dataset source: ${source}","messagePattern":"Cannot determine repository name from dataset source: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/tb/dataset.ts","lineNumber":38,"sourceCode":"async function validateTasksDir(tasksDir: string): Promise<string> {\n\tconst absolute = path.resolve(tasksDir);\n\ttry {\n\t\tconst entries = await fs.readdir(absolute, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tif (!entry.isDirectory()) continue;\n\t\t\tif (await Bun.file(path.join(absolute, entry.name, \"task.toml\")).exists()) return absolute;\n\t\t}\n\t} catch (error) {\n\t\tif (isEnoent(error)) throw new Error(`Terminal-Bench tasks directory does not exist: ${absolute}`);\n\t\tthrow error;\n\t}\n\tthrow new Error(`Terminal-Bench tasks directory contains no task.toml files: ${absolute}`);\n}\n\nfunction repositoryName(source: string): string {\n\tconst trimmed = source.replace(/\\/+$/, \"\");\n\tconst basename = trimmed.slice(trimmed.lastIndexOf(\"/\") + 1).replace(/\\.git$/, \"\");\n\tif (!basename) throw new Error(`Cannot determine repository name from dataset source: ${source}`);\n\treturn basename;\n}\n\nfunction gitError(action: string, source: string, stderr: Uint8Array): Error {\n\tconst detail = new TextDecoder().decode(stderr).trim();\n\treturn new Error(`${action} ${source} failed${detail ? `: ${detail}` : \"\"}`);\n}\n\nexport async function resolveDataset(source: string, cacheDir: string): Promise<string> {\n\tconst sourceKind = await directoryStat(source);\n\tif (sourceKind === \"directory\") {\n\t\tconst absoluteSource = path.resolve(source);\n\t\tconst nestedTasks = path.join(absoluteSource, \"tasks\");\n\t\tconst tasksDir = (await directoryStat(nestedTasks)) === \"directory\" ? nestedTasks : absoluteSource;\n\t\treturn validateTasksDir(tasksDir);\n\t}\n\tif (sourceKind === \"other\") throw new Error(`Terminal-Bench dataset source is not a directory: ${source}`);\n","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/tb/dataset.ts#L20-L56","documentation":"repositoryName derives a cache directory name from a dataset source by taking the last path segment (stripping trailing slashes and .git). If the source reduces to an empty basename (e.g. source is '/' or ends with '/.git' collapsing to empty), the cache location cannot be determined, so it throws.","triggerScenarios":"checkoutDir (via resolveDataset) receives a git URL whose post-processing basename is empty — e.g. source 'https://host/' or a path of only slashes.","commonSituations":"Config with a truncated URL (host only, no repo path); template variable left empty in a script building the dataset URL.","solutions":["Pass a full git URL including the repository name, e.g. https://github.com/owner/repo.git","Fix empty/unexpanded template variables in the script constructing the source","Verify the source string has a non-empty last path segment"],"exampleFix":"// before\nresolveDataset(\"https://github.com/laude-institute/\")\n// after\nresolveDataset(\"https://github.com/laude-institute/terminal-bench.git\")","handlingStrategy":"validation","validationCode":"function hasBasename(source: string): boolean {\n  const trimmed = source.replace(/\\/+$/, \"\");\n  return trimmed.slice(trimmed.lastIndexOf(\"/\") + 1).replace(/\\.git$/, \"\").length > 0;\n}\nif (!hasBasename(source)) throw new Error(`Dataset source needs a repo name: ${source}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass full git URLs ending in a repo name","Check for unexpanded template variables in scripts","Avoid bare host URLs as dataset sources"],"tags":["dataset","git","argument-parsing"],"backgroundTag":"invalid-dataset-source","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}