Repro steps:
Environment
- Elasticsearch / Kibana 9.4.2 (self-managed, ECK)
- Fleet space awareness: not enabled
- Elasticsearch license: basic
- Kibana space: default
- Fleet agent policy with an enrolled, online agent (created for private-location use)
Setup
export KIBANA_URL="https://<kibana-host>"
export KIBANA_USER="<user>"
export KIBANA_PASS="<pass>"
export POLICY_ID="<agent-policy-id>"
1. Fleet policy has no meaningful space_ids
curl -sk -u "${KIBANA_USER}:${KIBANA_PASS}" -H 'kbn-xsrf: true' \
"${KIBANA_URL}/s/default/api/fleet/agent_policies?perPage=1000" \
| jq --arg id "$POLICY_ID" '.items[] | select(.id == $id) | {id, name, space_ids, agents, namespace}'
Response:
{
"id": "<agent-policy-id>",
"name": "<policy-name>",
"space_ids": null,
"agents": 0,
"namespace": "<namespace>"
}
All other policies on this cluster also return space_ids: null.
2. Create private location - omit spaces (API docs: "available in all spaces")
curl -sk -u "${KIBANA_USER}:${KIBANA_PASS}" \
-H 'kbn-xsrf: true' -H 'Content-Type: application/json' \
-X POST "${KIBANA_URL}/s/default/api/synthetics/private_locations" \
-d "{\"label\":\"demo-no-spaces\",\"agentPolicyId\":\"${POLICY_ID}\",\"tags\":[\"demo\"]}"
Response - HTTP 500:
{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal server error occurred. Check Kibana server logs for details."
}
Kibana log:
Error: options.namespaces cannot be an empty array: Bad Request
3. Create private location - spaces: ["default"]
curl -sk -u "${KIBANA_USER}:${KIBANA_PASS}" \
-H 'kbn-xsrf: true' -H 'Content-Type: application/json' \
-X POST "${KIBANA_URL}/s/default/api/synthetics/private_locations" \
-d "{\"label\":\"demo-with-spaces\",\"agentPolicyId\":\"${POLICY_ID}\",\"tags\":[\"demo\"],\"spaces\":[\"default\"]}"
Response - HTTP 400:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Invalid spaces. Private location spaces [default] must be fully contained within agent policy <agent-policy-id> spaces []."
}
4. space_ids in policy create request does not persist
curl -sk -u "${KIBANA_USER}:${KIBANA_PASS}" \
-H 'kbn-xsrf: true' -H 'Content-Type: application/json' \
-X POST "${KIBANA_URL}/s/default/api/fleet/agent_policies" \
-d '{
"name": "demo-policy-delete-me",
"description": "space_ids test",
"namespace": "default",
"monitoring_enabled": ["logs", "metrics"],
"space_ids": ["default"]
}'
Create response (excerpt):
{
"item": {
"id": "<new-policy-id>",
"name": "demo-policy-delete-me",
"space_ids": null
}
}
List after create:
{
"id": "<new-policy-id>",
"name": "demo-policy-delete-me",
"space_ids": null
}
Private location on that new policy - same 400:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Invalid spaces. Private location spaces [default] must be fully contained within agent policy <new-policy-id> spaces []."
}