Search code examples
kubernetesconfigmap

What is the reason for Kubernetes error "a line break is expected" when updating ConfigMap?


I encountered an error like this when updating a Kubernetes ConfigMap (YAML), via a JSON file upload for the value content:

a line break is expected (20:22) 17 | - 1 18 | - 683d 19 | data: 20 | file.json |+file.json: "{\n\t"key...-----------------------^ 21 | # key: string | __clone: true

Not sure what this could be, as I have verified the source file to be valid JSON.

Method of ConfigMap creation:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-files


Solution

  • In my case, the reason for this error was that, though the source JSON file was valid JSON, it contained tab characters (\t), that are not acceptable for YAML.

    See here: