# Unable to create private location

**URL:** https://discuss.elastic.co/t/unable-to-create-private-location/386864
**Category:** Elastic Agent
**Tags:** fleet
**Created:** [June 15, 2026, 1:45pm UTC](https://discuss.elastic.co/t/unable-to-create-private-location/386864 "2026-06-15T13:45:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![umesh2020](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umesh2020/32/126038_2.png) [@umesh2020](https://discuss.elastic.co/u/umesh2020)
#### Post date: [June 15, 2026, 1:45pm UTC](https://discuss.elastic.co/t/unable-to-create-private-location/386864/1 "2026-06-15T13:45:57Z")

</div>

Invalid spaces. Private location spaces [default] must be fully contained within agent policy 532963e5-1c04-4475-b0a3-0d807c6a12e7 spaces [].

> GET kbn:/api/fleet/agent\_policies/532963e5-1c04-4475-b0a3-0d807c6a12e7
> 
> {
> 
> "item": {
> 
> "id": "532963e5-1c04-4475-b0a3-0d807c6a12e7",
> 
> "version": "WzE2OTIyLDY0XQ==",
> 
> "created\_at": "2026-06-12T19:00:00.169Z",
> 
> "space\_ids": [],
> 
> "description": "Private Location Agent Policy",
> 
> "monitoring\_enabled": [
> 
> "logs",
> 
> "metrics"
> 
> ```
> \],
> 
> ```
> 
> "inactivity\_timeout": 1209600,
> 
> "schema\_version": "1.1.1",
> 
> "package\_policies": [],
> 
> "agents": 0,
> 
> "name": "Priv Location Agent Policy",
> 
> "namespace": "default",
> 
> "status": "active",
> 
> "is\_managed": false,

---

<div class="post-metadata">

### Author: ![rozling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rozling/32/16401_2.png) [@rozling](https://discuss.elastic.co/u/rozling)
#### Post date: [June 16, 2026, 10:04am UTC](https://discuss.elastic.co/t/unable-to-create-private-location/386864/2 "2026-06-16T10:04:52Z")

</div>

Same issue here on self-managed ECK 9.4.2.

We’re trying to use Synthetics private locations for internal HTTPS / certificate monitoring. My understanding is that this _should_ be possible without Fleet Space Awareness / Enterprise, because we only need a private location on our own Elastic Agent in the default space.

We have:

- Fleet Server running

- Elastic Agent enrolled and online

- Agent assigned to the intended policy

- Synthetics available in Kibana

The blocker is creating the private location.

Based on the error message, `POST /api/private_locations` seems to validate that the requested private location's `spaces` are contained within the selected Fleet agent policy’s `space_ids`.

The problem is that on our 9.4.2 deployment, newly created Fleet policies don't get useful `space_ids`.

In the Fleet API they appear as `null` (effectively `[]`), even when you specify `space_ids` in the create request.

That seems to match your [other thread](https://discuss.elastic.co/t/newly-created-agent-policy-has-space-id-set-to-null-in-version-9-4-2/386845/3).

@leandrojmp mentions there that this is expected unless Fleet Space Awareness is enabled. But Fleet Space Awareness requires Enterprise, which we do not have.

That leaves us stuck:

- Creating a private location with `spaces: ["default"]` fails with:

```auto
Invalid spaces. Private location spaces [default] must be fully contained within agent policy <policy-id> spaces [].

```

- Creating a private location with `spaces` omitted fails with:

```auto
options.namespaces cannot be an empty array

```

The second case also seems to contradict the API docs, which say of the `spaces` parameter:

> If it is not provided, the private location is available in all spaces.

> **[Body Required - Create a private location | Kibana API documentation](https://www.elastic.co/docs/api/doc/kibana/operation/operation-post-private-location#operation-post-private-location-body-application-json-spaces)**
>
> Spaces method and path for this operation:
> post /s/{spaceid}/api/synthetics/privatelocations
> Refer to Spaces for more information.
> You must have all privileges for the Synt...

So it looks like private locations may currently be blocked on upgraded, non-space-aware Fleet deployments: the Synthetics API requires space alignment, but the Fleet policy has no usable `space_ids`, and enabling Fleet Space Awareness is not available on Basic.

Is this expected behaviour in 9.4.2, or a bug/regression in the private location validation for non-space-aware Fleet policies?

Happy to share the exact API payloads, Fleet policy response, Kibana logs etc if useful.

---

<div class="post-metadata">

### Author: ![rozling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rozling/32/16401_2.png) [@rozling](https://discuss.elastic.co/u/rozling)
#### Post date: [June 16, 2026, 10:09am UTC](https://discuss.elastic.co/t/unable-to-create-private-location/386864/3 "2026-06-16T10:09:02Z")

</div>

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

```bash
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`

```bash
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:**

```json
{
  "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")

```bash
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:**

```json
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "An internal server error occurred. Check Kibana server logs for details."
}

```

Kibana log:

```plaintext
Error: options.namespaces cannot be an empty array: Bad Request

```

* * *

### 3. Create private location - `spaces: ["default"]`

```bash
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:**

```json
{
  "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

```bash
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):**

```json
{
  "item": {
    "id": "<new-policy-id>",
    "name": "demo-policy-delete-me",
    "space_ids": null
  }
}

```

**List after create:**

```json
{
  "id": "<new-policy-id>",
  "name": "demo-policy-delete-me",
  "space_ids": null
}

```

**Private location on that new policy - same 400:**

```json
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Invalid spaces. Private location spaces [default] must be fully contained within agent policy <new-policy-id> spaces []."
}

```
