GoogleCloudPlatform / GoogleCloudPlatform/gsutil
Failed to setmeta data - Error: Invalid Argument
- Dominant language
- Python
- Stars
- 918
- Forks
- 335
- PR merge metrics
- No merged PRs in 30d
Description
Gsutil setmeta command fails with error. Invalid Argument.
Trying to edit the existing meta data:
$gsutil setmeta -h "x-goog-meta-opts:helloworld" gs://
Setting metadata on gs://
BadRequestException: 400 InvalidArgument
InvalidArgumentInvalid argument.
Adding new metadata works well with cp command. (this test resolves any authentication related issues).
$gsutil -h "x-goog-meta-opts:earth" cp gs://
Copying file: [Content-Type=text/plain]...
\ [1 files][ 10.0 MiB/ 10.0 MiB]
Operation completed over 1 objects/10.0 MiB.
Here is the debug trace:
DEBUG: Exception stack trace:
Traceback (most recent call last):
File " gsutil/gslib/__main__.py", line 571, in _RunNamedCommandAndHandleExceptions
user_project=user_project)
File " gsutil/gslib/command_runner.py", line 319, in RunNamedCommand
return_code = command_inst.RunCommand()
File " gsutil/gslib/commands/setmeta.py", line 206, in RunCommand
seek_ahead_iterator=seek_ahead_iterator)
File " gsutil/gslib/command.py", line 1383, in Apply
arg_checker, should_return_results, fail_on_error)
File " gsutil/gslib/command.py", line 1454, in _SequentialApply
worker_thread.PerformTask(task, self)
File " gsutil/gslib/command.py", line 2120, in PerformTask
results = task.func(cls, task.args, thread_state=self.thread_gsutil_api)
File " gsutil/gslib/commands/setmeta.py", line 128, in _SetMetadataFuncWrapper
cls.SetMetadataFunc(name_expansion_result, thread_state=thread_state)
File " gsutil/third_party/retry-decorator/retry_decorator/retry_decorator.py", line 20, in f_retry
return f(*args, **kwargs)
File " gsutil/gslib/commands/setmeta.py", line 261, in SetMetadataFunc
provider=exp_src_url.scheme, fields=['id'])
File " gsutil/gslib/cloud_api_delegator.py", line 261, in PatchObjectMetadata
generation=generation, preconditions=preconditions, fields=fields)
File " gsutil/gslib/boto_translation.py", line 702, in PatchObjectMetadata
generation=generation)
File " gsutil/gslib/boto_translation.py", line 1502, in _TranslateExceptionAndRaise
raise translated_exception
BadRequestException: BadRequestException: 400 InvalidArgument
InvalidArgumentInvalid argument.
BadRequestException: 400 InvalidArgument
InvalidArgumentInvalid argument.
Contributor guide
Research direction
Reproduce the failure with the gsutil setmeta command and compare it with the working cp metadata command. Start in gslib/commands/setmeta.py, following SetMetadataFunc into cloud_api_delegator.py and boto_translation.py, as shown in the trace. Done means updating existing object metadata succeeds and the x-goog-meta-opts value is visible afterward.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100