{"record":{"id":"d115ecbb6471e5a1","repo":"Graphify-Labs/graphify","slug":"google-workspace-shortcut-path-does-not-include","errorCode":null,"errorMessage":"Google Workspace shortcut {path} does not include a Drive file ID","messagePattern":"Google Workspace shortcut (.+?) does not include a Drive file ID","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"graphify/google_workspace.py","lineNumber":84,"sourceCode":"        data = json.loads(path.read_text(encoding=\"utf-8\"))\n    except Exception as exc:\n        raise RuntimeError(f\"could not read Google Workspace shortcut {path}: {exc}\") from exc\n\n    url = str(data.get(\"url\") or \"\")\n    file_id = (\n        data.get(\"doc_id\")\n        or data.get(\"file_id\")\n        or data.get(\"fileId\")\n        or data.get(\"id\")\n        or _extract_file_id_from_url(url)\n    )\n    if not file_id:\n        resource_id = str(data.get(\"resource_id\") or \"\")\n        if \":\" in resource_id:\n            file_id = resource_id.split(\":\", 1)[1]\n\n    if not file_id:\n        raise RuntimeError(f\"Google Workspace shortcut {path} does not include a Drive file ID\")\n\n    return {\n        \"file_id\": str(file_id),\n        \"url\": url or None,\n        \"resource_key\": _extract_resource_key(url, data),\n        \"account\": str(data.get(\"email\")) if data.get(\"email\") else None,\n    }\n\n\ndef _run_gws_export(file_id: str, mime_type: str, output: Path, resource_key: str | None = None) -> None:\n    exe = shutil.which(\"gws\")\n    if not exe:\n        raise RuntimeError(\n            \"gws is required for Google Workspace export. Install it from \"\n            \"https://github.com/googleworkspace/cli and run `gws auth login -s drive`.\"\n        )\n\n    params: dict[str, str] = {\"fileId\": file_id, \"mimeType\": mime_type}","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/google_workspace.py#L66-L102","documentation":"Raised by read_google_shortcut when the shortcut JSON parsed fine but no Drive file ID could be recovered. The exporter tries doc_id, file_id, fileId, id, then parses the url query/path, then tries resource_id with a 'prefix:id' split; if all of those are empty, there is nothing to export and it raises instead of calling gws with a blank ID.","triggerScenarios":"A .gdoc/.gsheet/.gslides file whose JSON has none of the recognized ID keys, a url without an extractable ID (e.g. a folder link or FQDN-only url), and no colon-separated resource_id — e.g. hand-written shortcuts or a schema change by whatever produced the file.","commonSituations":"Team-created shortcut files with custom/internal key names; Drive schema drift in third-party sync tools; shortcuts to Drive folders (no document file ID) saved with document extensions.","solutions":["Open the shortcut JSON and add a recognized key: \"doc_id\" or \"file_id\" with the Drive file ID","Or set url to a standard Drive URL containing the ID (https://docs.google.com/.../d/<fileId>/...)","If the target is a Drive folder or non-exportable item, remove the shortcut from the scanned tree"],"exampleFix":"# before\n{\"url\": \"https://drive.google.com/\", \"name\": \"spec\"}   # no ID anywhere\n\n# after\n{\"url\": \"https://docs.google.com/document/d/1AbC.../edit\", \"doc_id\": \"1AbC...\"}","handlingStrategy":"validation","validationCode":"import re\n\nSHORTCUT_KEYS = (\"doc_id\", \"file_id\", \"fileId\", \"id\")\n_DRIVE_ID_RE = re.compile(r\"/d/([A-Za-z0-9_-]{10,})\")\n\ndef shortcut_has_file_id(data: dict) -> bool:\n    if any(data.get(k) for k in SHORTCUT_KEYS):\n        return True\n    url = str(data.get(\"url\") or \"\")\n    if _DRIVE_ID_RE.search(url):\n        return True\n    rid = str(data.get(\"resource_id\") or \"\")\n    return \":\" in rid and rid.split(\":\", 1)[1] != \"\"","typeGuard":null,"tryCatchPattern":"try:\n    meta = read_google_shortcut(path)\nexcept RuntimeError as e:\n    if \"does not include a Drive file ID\" in str(e):\n        log.warning(\"shortcut %s lacks a file ID - skipping\", path)\n    else:\n        raise","preventionTips":["Write shortcuts with at least one recognized key (doc_id/file_id/fileId/id) or a /d/<id>/ URL","Don't use document extensions for Drive folder links","Run a batch preflight that checks every shortcut for an extractable ID before a big scan"],"tags":["google-workspace","validation","metadata","ingest"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}