apache/beam · warning

Saw topic in v1beta1 format. Topics should be in the…

Error message

Saw topic in v1beta1 format.  Topics should be in the format projects/<project_id>/topics/<topic_name>

What it means

PubsubIO.fromPath detects that the given topic path matches the legacy Cloud Pub/Sub v1beta1 naming scheme instead of the canonical projects/<project_id>/topics/<topic_name> format. The library still parses the legacy form for backwards compatibility but logs this warning because the v1beta1 format is deprecated and may stop working. No exception is thrown; the pipeline continues with the parsed project and topic names.

Solutions

  1. Rewrite the topic path to the canonical format: projects/<project_id>/topics/<topic_name>.
  2. If constructing the path programmatically, use PubsubIO.topicFromPath or a helper like PubsubClient.topicPathFromName(project, topic).
  3. Update legacy configuration files or job parameters that still contain '/topics/<project>/<topic>' style paths.

Example fix

// before
PubsubIO.readStrings().from("/topics/my-gcp-project/my-topic")

// after
PubsubIO.readStrings().from("projects/my-gcp-project/topics/my-topic")
Defensive patterns

Strategy: validation

Validate before calling

Pattern TOPIC = Pattern.compile("^projects/([^/]+)/topics/([^/]+)$");
if (!TOPIC.matcher(topicPath).matches()) {
  throw new IllegalArgumentException(
      "Topic must be in format projects/<project_id>/topics/<topic_name>: " + topicPath);
}

Prevention

When it happens

Trigger: Calling PubsubIO.readStrings().from(topic) / PubsubIO.fromPath with a topic string matching V1BETA1_TOPIC_REGEXP (e.g. '/topics/my-project/my-topic' or 'my-project/my-topic') rather than the fully qualified v1 format 'projects/my-project/topics/my-topic'.

Common situations: Migrating old pipelines written against the deprecated Pub/Sub beta API; hardcoding topic paths copied from legacy configs or tutorials; building topic paths from (project, topic) pairs without the projects/.../topics/ template.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/e9886df51df33718. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java:475

     * <ul>
     *   <li>Can only contain lowercase letters, numbers, dashes ('-'), underscores ('_') and
     *       periods ('.').
     *   <li>Must be between 3 and 255 characters.
     *   <li>Must begin with a letter.
     *   <li>Must end with a letter or a number.
     *   <li>Cannot begin with 'goog' prefix.
     * </ul>
     */
    public static PubsubTopic fromPath(String path) {
      if (path.equals(TOPIC_DEV_NULL_TEST_NAME)) {
        return new PubsubTopic(PubsubTopic.Type.FAKE, "", path);
      }

      String projectName, topicName;

      Matcher v1beta1Match = V1BETA1_TOPIC_REGEXP.matcher(path);
      if (v1beta1Match.matches()) {
        LOG.warn(
            "Saw topic in v1beta1 format.  Topics should be in the format "
                + "projects/<project_id>/topics/<topic_name>");
        projectName = v1beta1Match.group(1);
        topicName = v1beta1Match.group(2);
      } else {
        Matcher match = TOPIC_REGEXP.matcher(path);
        if (!match.matches()) {
          throw new IllegalArgumentException(
              "Pubsub topic is not in projects/<project_id>/topics/<topic_name> format: " + path);
        }
        projectName = match.group(1);
        topicName = match.group(2);
      }

      projectName =
          checkArgumentNotNull(
              projectName, "Invalid path: project name must be non-null: %s", path);
      topicName =

View on GitHub (pinned to 12126d8942)