{"record":{"id":"1a8951ff33a64dcb","repo":"HumanSignal/label-studio","slug":"self-url-scheme-self-container-self-prefix","errorCode":null,"errorMessage":"{self.url_scheme}://{self.container}/{self.prefix} not found.","messagePattern":"(.+?)://(.+?)/(.+?) not found\\.","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"label_studio/io_storages/azure_blob/models.py","lineNumber":102,"sourceCode":"        client, container = self.get_client_and_container()\n\n        try:\n            container_properties = container.get_container_properties()\n            logger.debug(f'Container exists: {container_properties.name}')\n        except ResourceNotFoundError:\n            raise KeyError(f'Container not found: {self.container}')\n\n        # Check path existence for Import storages only\n        if self.prefix and 'Export' not in self.__class__.__name__:\n            logger.debug(f'Test connection to container {self.container} with prefix {self.prefix}')\n            prefix = str(self.prefix)\n            try:\n                blob = next(container.list_blob_names(name_starts_with=prefix))\n            except StopIteration:\n                blob = None\n\n            if not blob:\n                raise KeyError(f'{self.url_scheme}://{self.container}/{self.prefix} not found.')\n\n    def get_bytes_stream(self, uri, range_header=None):\n        \"\"\"Get file bytes from Azure Blob storage as a streaming object with metadata.\n\n        Implements range request support similar to GCS and S3 implementations:\n        - Accepts ``range_header`` in format ``bytes=start-end``\n        - Uses Azure's download_blob with offset/length for efficient ranged access\n        - Returns a tuple of (stream_with_iter_chunks, content_type, metadata_dict)\n\n        Args:\n            uri: The Azure URI of the file to retrieve\n            range_header: Optional HTTP Range header to limit bytes\n\n        Returns:\n            Tuple of (streaming body with iter_chunks, content_type, metadata)\n        \"\"\"\n        # Parse URI to get container and blob name\n        parsed_uri = urlparse(uri, allow_fragments=False)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/HumanSignal/label-studio/blob/0b49e9b53917880baf1dd85d574fe5541a9aafb2/label_studio/io_storages/azure_blob/models.py#L84-L120","documentation":"After confirming the container exists, validate_connection checks that at least one blob exists under the configured prefix (import storages only); if list_blob_names yields nothing it raises KeyError('<scheme>://<container>/<prefix> not found.'). The storage is reachable but the prefix path is empty or wrong.","triggerScenarios":"Creating/validating an Azure Blob import storage with a prefix that matches no blobs in the container — prefix typo, wrong nesting depth, or container genuinely empty under that path.","commonSituations":"Prefix 'data/' when files are at root (trailing-slash/nesting mismatch); files uploaded to a different container; case sensitivity ('Data/' vs 'data/'); syncing a container whose contents were moved to another account.","solutions":["Verify with 'az storage blob list --container-name <c> --prefix <p>' that blobs exist under the prefix","Correct the prefix to match actual blob paths (watch trailing slash and case)","Upload at least one blob under the prefix before validating","Remove the prefix if you want to validate against the container root"],"exampleFix":"// before\n{\"container\": \"docs\", \"prefix\": \"Data/2024\"}  // blobs are at data/2024/ → KeyError not found\n// after\n{\"container\": \"docs\", \"prefix\": \"data/2024\"}  → 200 valid","handlingStrategy":"validation","validationCode":"from azure.storage.blob import BlobServiceClient\nsvc = BlobServiceClient(account_url=f\"https://{acct}.blob.core.windows.net\", credential=key)\nblobs = list(svc.get_container_client(container).list_blob_names(name_starts_with=prefix))\nassert blobs, f\"No blobs under prefix '{prefix}' in container '{container}'\"","typeGuard":"def prefix_has_blobs(svc, container, prefix):\n    return next(svc.get_container_client(container).list_blob_names(name_starts_with=prefix), None) is not None","tryCatchPattern":"try:\n    resp = requests.post(f\"{LS_URL}/api/storages/azure/validate/\", json=payload, headers=headers)\n    resp.raise_for_status()\nexcept requests.HTTPError as e:\n    if \"not found\" in resp.text:\n        logging.error(\"Fix prefix or upload blobs under %s\", prefix)","preventionTips":["Match prefix nesting/trailing slash to actual blob paths","Check case sensitivity of prefix ('Data/' != 'data/')","Upload at least one blob under the prefix before validation","Omit prefix to validate against the container root"],"tags":["azure","cloud-storage","not-found","prefix","validation"],"backgroundTag":"prefix-not-found","analyzedSha":"0b49e9b53917880baf1dd85d574fe5541a9aafb2","analyzedAt":"2026-08-29T00:39:52.578Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}