{"record":{"id":"03f8f70b70eb139f","repo":"hashicorp/vagrant","slug":"the-vagrant-cloud-server-responded-with-a-not-ok-r","errorCode":null,"errorMessage":"The Vagrant Cloud server responded with a not-OK response:\n\n%{errors}","messagePattern":"The Vagrant Cloud server responded with a not-OK response:\n\n%(.+?)","errorType":"exception","errorClass":"VagrantPlugins::CloudCommand::Errors::ServerError","httpStatus":400,"severity":"error","filePath":"plugins/commands/cloud/client/client.rb","lineNumber":194,"sourceCode":"      protected\n\n      def with_error_handling(&block)\n        yield\n      rescue VagrantCloud::Error::ClientError => e\n        @logger.debug(\"vagrantcloud request error:\")\n        @logger.debug(e.message)\n        @logger.debug(e.backtrace.join(\"\\n\"))\n        raise Errors::Unexpected, error: e.message\n      rescue Excon::Error::Unauthorized\n        @logger.debug(\"Unauthorized!\")\n        raise Errors::Unauthorized\n      rescue Excon::Error::BadRequest => e\n        @logger.debug(\"Bad request:\")\n        @logger.debug(e.message)\n        @logger.debug(e.backtrace.join(\"\\n\"))\n        parsed_response = JSON.parse(e.response.body)\n        errors = parsed_response[\"errors\"].join(\"\\n\")\n        raise Errors::ServerError, errors: errors\n      rescue Excon::Error::NotAcceptable => e\n        @logger.debug(\"Got unacceptable response:\")\n        @logger.debug(e.message)\n        @logger.debug(e.backtrace.join(\"\\n\"))\n\n        parsed_response = JSON.parse(e.response.body)\n\n        if two_factor = parsed_response['two_factor']\n          store_two_factor_information two_factor\n\n          if two_factor_default_delivery_method != APP\n            request_code two_factor_default_delivery_method\n          end\n\n          raise Errors::TwoFactorRequired\n        end\n\n        begin","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/cloud/client/client.rb#L176-L212","documentation":"Vagrant::Errors::ServerError is raised when Vagrant Cloud answers 400 Bad Request. The client JSON-parses the response body and joins its `errors` array into the message, so the text is the server's own validation feedback — typically a duplicate resource, an invalid field value, or a malformed payload.","triggerScenarios":"POST/PUT requests whose payload fails server-side validation: creating a box that already exists (`vagrant cloud box create` on an existing org/box), an invalid version string, a checksum type outside md5/sha1/sha256/sha384/sha512, or an invalid provider URL during provider create/update/publish.","commonSituations":"Re-running a publish/create script after a partially successful first run (the box or version already exists); version typos like `1.0` instead of `1.0.0`; using an unsupported --checksum-type; scripts written against older, laxer API rules.","solutions":["Read the joined error lines in the message — they name the exact invalid field or conflict","If the error is a duplicate, use the update variant (`vagrant cloud box update`, `vagrant cloud provider update`) or delete the existing resource first","Correct the payload: semantic version format, supported checksum algorithm, well-formed https URL","Re-run with VAGRANT_LOG=debug if the message was truncated or ambiguous"],"exampleFix":"# before\nvagrant cloud provider create myorg/mybox virtualbox 1.0.0 --checksum-type sha123\n# after\nvagrant cloud provider create myorg/mybox virtualbox 1.0.0 --checksum-type sha256","handlingStrategy":"validation","validationCode":"# Pre-validate the fields Vagrant Cloud rejects with 400 before calling the CLI\nabort \"bad version '#{version}'\" unless version.match?(/\\A\\d+\\.\\d+\\.\\d+\\S*\\z/)\nabort \"bad checksum type\" unless %w[md5 sha1 sha256 sha384 sha512].include?(checksum_type)\nabort \"bad url\" unless url.nil? || url.start_with?(\"http://\", \"https://\")","typeGuard":null,"tryCatchPattern":"begin\n  env.cli(%w[cloud provider create], org_box, provider, version, url)\nrescue Vagrant::Errors::ServerError => e\n  # e.message is the server's joined 'errors' array — one line per problem\n  $stderr.puts \"Vagrant Cloud rejected the payload:\"\n  e.message.each_line { |l| $stderr.puts \"  #{l}\" }\n  exit 1\nend","preventionTips":["Check for existing resources (`vagrant cloud box show`) before create/publish to avoid duplicates","Enforce semantic-version format and checksum-type enums in your release scripts","Parse ServerError messages line-by-line — each line maps to one server-side validation failure"],"tags":["vagrant","vagrant-cloud","http-400","api","validation"],"backgroundTag":"http-400-bad-request","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}