onetimesecret/onetimesecret · error · Onetime::Problem

Duplicate domain for organization

Error message

Duplicate domain for organization

What it means

Error "Duplicate domain for organization" thrown in onetimesecret/onetimesecret.

Source

Thrown at lib/onetime/models/custom_domain.rb:883

            # it's safe even when the original failure was an org-lookup error.
            -> {
              obj.organization_instances.each do |o|
                obj.remove_from_organization_domains(o)
              end
            },
          ]
          rollback_steps.each do |step|
            step.call
          rescue StandardError => step_ex
            OT.le "[CustomDomain.create!] rollback step failed for #{obj.display_domain}: #{step_ex.message}"
          end
          raise ex
        end

        obj # Return the created object
      rescue Familia::RecordExistsError => ex
        OT.le "[CustomDomain.create!] Duplicate domain: #{ex.message}"
        raise Onetime::Problem, 'Duplicate domain for organization'
      rescue Redis::BaseError => ex
        OT.le "[CustomDomain.create!] Redis error: #{ex.message}"
        raise Onetime::Problem, 'Unable to create custom domain'
      end

      # Create default-disabled HomepageConfig and ApiConfig records for a
      # freshly created CustomDomain. Idempotent via find_or_create_for_domain
      # (WATCH+MULTI), so a concurrent PUT that wrote first preserves its value.
      def bootstrap_per_domain_configs(obj)
        Onetime::CustomDomain::HomepageConfig.find_or_create_for_domain(
          domain_id: obj.identifier, enabled: false,
        )
        Onetime::CustomDomain::ApiConfig.find_or_create_for_domain(
          domain_id: obj.identifier, enabled: false,
        )
      end

      # Atomically claim an orphaned domain for an organization.

View on GitHub (pinned to f81295e41b)

Solutions

  1. Find the existing domain record for this organization and reuse or update it instead of creating a duplicate.

When it happens

Trigger: Thrown at lib/onetime/models/custom_domain.rb:883 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of onetimesecret/onetimesecret@f81295e41b (2026-08-23). Data as JSON: /api/errors/cfbe7a7aa6599b79. Report an issue: GitHub.