{"record":{"id":"cb17ea7f4e391fa0","repo":"usestrix/strix","slug":"missing-postman-collection-id-in-target-expec","errorCode":null,"errorMessage":"Missing Postman collection id in '{target}' (expected postman://<collection-uid>)","messagePattern":"Missing Postman collection id in '(.+?)' \\(expected postman://<collection-uid>\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/interface/utils.py","lineNumber":1129,"sourceCode":"\n\ndef infer_target_type(target: str) -> tuple[str, dict[str, str]]:  # noqa: PLR0911\n    if not target or not isinstance(target, str):\n        raise ValueError(\"Target must be a non-empty string\")\n\n    target = target.strip()\n\n    if target.startswith(\"git@\"):\n        return \"repository\", {\"target_repo\": target}\n\n    if target.startswith(\"git://\"):\n        return \"repository\", {\"target_repo\": target}\n\n    parsed = urlparse(target)\n    if parsed.scheme == \"postman\":\n        collection_uid = f\"{parsed.netloc}{parsed.path}\".strip(\"/\")\n        if not collection_uid:\n            raise ValueError(\n                f\"Missing Postman collection id in '{target}' (expected postman://<collection-uid>)\"\n            )\n        details = {\n            \"target_spec\": target,\n            \"spec_format\": \"postman\",\n            \"source\": \"postman_api\",\n            \"collection_uid\": collection_uid,\n        }\n        query = parse_qs(parsed.query)\n        env_uid = (query.get(\"env\") or query.get(\"environment\") or [\"\"])[0].strip()\n        if env_uid:\n            details[\"environment_uid\"] = env_uid\n        return \"api_spec\", details\n\n    if parsed.scheme in (\"http\", \"https\"):\n        if parsed.username or parsed.password:\n            return \"repository\", {\"target_repo\": target}\n        if parsed.path.rstrip(\"/\").endswith(\".git\"):","sourceCodeStart":1111,"sourceCodeEnd":1147,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/utils.py#L1111-L1147","documentation":"Raised when a target uses the postman:// scheme but no collection uid follows it. Strix expects the form postman://<collection-uid> with an optional ?env=<environment-uid> query; urlparse yields an empty netloc+path for bare 'postman://' so the reconstructed collection_uid is empty.","triggerScenarios":"Calling infer_target_type('postman://') or 'postman:///'; a truncated or mistyped target like 'postman://' plus only an env query, e.g. 'postman://?env=123-abc'.","commonSituations":"Copy-pasting a Postman URL that got truncated; hand-building the postman:// URI from a template and forgetting to substitute the uid placeholder; URL-encoding mistakes that push the uid into the query string.","solutions":["Use the full form: postman://<collection-uid> (optionally postman://<collection-uid>?env=<environment-uid>).","Copy the collection uid from Postman (Collection info) or the Postman API (GET /collections) and paste it directly.","Ensure POSTMAN_API_KEY is also set, since the Postman source requires it to fetch the collection."],"exampleFix":"# before\nstrix -n -t \"postman://?env=12345-abcdef\"\n\n# after\nstrix -n -t \"postman://12345-abcdef?env=67890-fedcba\"","handlingStrategy":"validation","validationCode":"import re\n\ndef parse_postman_target(target: str) -> tuple[str, str | None]:\n    m = re.fullmatch(r\"postman://([^/?#]+)(?:[?&](?:env|environment)=([^&#]+))?\", target)\n    if not m:\n        raise ValueError(\"expected postman://<collection-uid>[?env=<environment-uid>]\")\n    return m.group(1), m.group(2)\n\ncol_uid, env_uid = parse_postman_target(target)  # raises before infer_target_type","typeGuard":"def is_wellformed_postman_uri(target: str) -> bool:\n    return bool(re.fullmatch(r\"postman://[^/?#]+(?:\\?.*)?\", target))","tryCatchPattern":"try:\n    ttype, details = infer_target_type(target)\nexcept ValueError as e:\n    if \"Missing Postman collection id\" in str(e):\n        raise SystemExit(\"Postman targets need a collection uid: postman://<uid>[?env=<env-uid>]\") from e\n    raise","preventionTips":["Validate postman:// URIs with a regex before passing them to the scanner","Keep Postman collection uids in configuration so they are pasted, not typed"],"tags":["postman","targets","validation","api-spec"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}