Skip to content

Handler 'on_field_data/data' failed with an exception. Will retry. #165

@iDmple

Description

@iDmple

Hi,

I'm getting this error on 0.0.14. My secret is a valid base64 .dockerconfigjson. It worked perfectly with 0.0.13.

[2025-06-11 11:32:59,467] kopf.objects         [ERROR   ] [regcred] Handler 'on_field_data/data' failed with an exception. Will retry.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/kopf/_core/actions/execution.py", line 276, in execute_handler_once
    result = await invoke_handler(
  File "/usr/local/lib/python3.9/site-packages/kopf/_core/actions/execution.py", line 371, in invoke_handler
    result = await invocation.invoke(
  File "/usr/local/lib/python3.9/site-packages/kopf/_core/actions/invocation.py", line 139, in invoke
    await asyncio.shield(future)  # slightly expensive: creates tasks
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/src/handlers.py", line 150, in on_field_data
    response = v1.replace_namespaced_secret(name=name, namespace=ns, body=ns_sec_body)
  File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 27733, in replace_namespaced_secret
    return self.replace_namespaced_secret_with_http_info(name, namespace, body, **kwargs)  # noqa: E501
  File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 27836, in replace_namespaced_secret_with_http_info
    return self.api_client.call_api(
  File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
  File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
    response_data = self.request(
  File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 399, in request
    return self.rest_client.PUT(url,
  File "/usr/local/lib/python3.9/site-packages/kubernetes/client/rest.py", line 285, in PUT
    return self.request("PUT", url,
  File "/usr/local/lib/python3.9/site-packages/kubernetes/client/rest.py", line 234, in request
    raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Audit-Id': '5300c821-e915-4d4f-aeab-f255eb430c32', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '2ff3794c-7638-4900-8448-869112b432a4', 'X-Kubernetes-Pf-Prioritylevel-Uid': '66e16f53-5ff8-41f6-bfaf-573cfd9d9bb9', 'Date': 'Wed, 11 Jun 2025 11:32:59 GMT', 'Content-Length': '206'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Secret in version \"v1\" cannot be handled as a Secret: illegal base64 data at input byte 0","reason":"BadRequest","code":400}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions