{"record":{"id":"88b74e36014fc01f","repo":"apache/pulsar","slug":"error-offloading-lasterror","errorCode":null,"errorMessage":"Error offloading: ${lastError}","messagePattern":"Error offloading: (.+?)","errorType":"exception","errorClass":"PulsarAdminException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java","lineNumber":1465,"sourceCode":"                while (wait && status.getStatus() == LongRunningProcessStatus.Status.RUNNING) {\n                    Thread.sleep(1000);\n                    status = getTopics().offloadStatus(persistentTopic);\n                }\n\n                switch (status.getStatus()) {\n                case NOT_RUN:\n                    System.out.println(\"Offload has not been run for \" + persistentTopic\n                                       + \" since broker startup\");\n                    break;\n                case RUNNING:\n                    System.out.println(\"Offload is currently running\");\n                    break;\n                case SUCCESS:\n                    System.out.println(\"Offload was a success\");\n                    break;\n                case ERROR:\n                    System.out.println(\"Error in offload\");\n                    throw new PulsarAdminException(\"Error offloading: \" + status.getLastError());\n                }\n            } catch (InterruptedException e) {\n                throw new PulsarAdminException(e);\n            }\n        }\n    }\n\n    @Command(description = \"get the last commit message id of topic\")\n    private class GetLastMessageId extends CliCommand {\n        @Parameters(description = \"persistent://tenant/namespace/topic\", arity = \"1\")\n        private String topicName;\n\n        @Override\n        void run() throws PulsarAdminException {\n            String persistentTopic = validatePersistentTopic(topicName);\n            print(getTopics().getLastMessageId(persistentTopic));\n        }\n    }","sourceCodeStart":1447,"sourceCodeEnd":1483,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java#L1447-L1483","documentation":"During tiered-storage offload, the CLI polls offload status; if the status is ERROR, it prints 'Error in offload' and throws PulsarAdminException with the broker-reported lastError. The offload to the configured storage provider failed server-side.","triggerScenarios":"Running `pulsar-admin topics offload <topic> --size-threshold <bytes>` when the broker cannot offload ledgers — misconfigured offloader driver, unreachable S3/GCS/Azure endpoint, bad credentials, or bucket permissions.","commonSituations":"Missing or wrong offloader configuration (offloaders not installed in the broker's ./offloaders directory); invalid cloud credentials; nonexistent bucket/container; network egress blocked from brokers.","solutions":["Read the ${lastError} suffix and broker logs for the provider-specific cause","Verify the offloader driver is installed and configured (offloaders dir, driver config, bucket/region/credentials)","Test cloud storage connectivity/permissions from the broker host","Fix configuration and re-run the offload command"],"exampleFix":"// before\npulsar-admin topics offload persistent://my-tenant/my-ns/my-topic --size-threshold 10M   # Error offloading: ...\n// after\n# after fixing offloader config/credentials\npulsar-admin topics offload persistent://my-tenant/my-ns/my-topic --size-threshold 10M","handlingStrategy":"try-catch","validationCode":"// Validate offload config before invoking: driver installed, bucket/credentials set\nOffloadPolicies policies = ...;\nif (policies == null || policies.getBucket() == null) {\n    throw new IllegalStateException(\"Offloader/bucket not configured\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    admin.topics().triggerOffload(topic, messageId);\n    admin.topics().offloadStatus(topic).waitForCompletion();\n} catch (org.apache.pulsar.client.admin.PulsarAdminException e) {\n    log.error(\"Offload failed server-side: {}\", e.getMessage(), e);\n    // check broker logs, offloader install, cloud credentials\n}","preventionTips":["Install the offloader drivers in the broker's offloaders directory","Validate cloud storage credentials, bucket, and region before offloading","Confirm network egress from brokers to the storage provider","Check offload status instead of assuming success"],"tags":["tiered-storage","offload","broker-error","cli"],"backgroundTag":"offload-failed","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}