---
title: "Catch policy errors before you save"
description: "The policy editor now flags Rego problems as you write, so mistakes surface before you save rather than after. In the web app, errors appear inline in the editor and in the error panel; autocomplete also suggests schema fields as you type."
canonical_url: "https://cloudsmith.com/changelog/catch-policy-errors-before-you-save"
last_updated: "2026-08-12T10:50:26.505Z"
---
# Catch policy errors before you save

The policy editor now flags Rego problems as you write, so mistakes surface before you save rather than after. In the web app, errors appear inline in the editor and in the error panel; autocomplete also suggests schema fields as you type.

When a policy is saved, the web app and API return errors for:

- Unknown or disallowed builtins, such as `http.send`
- Type mismatches and incorrect argument counts
- Unsafe or undeclared variable references
- Restricted variables in index-applicable policies

The web app editor checks three additional things the API does not: a warning when a policy omits `package cloudsmith` or a match rule, inline highlighting for malformed Rego that doesn't block saving, and autocomplete for schema field names.

```json
{
  "_key": "2c97967ee595",
  "_type": "image",
  "alt": "The Rego policy editor in the Cloudsmith web app",
  "asset": {
    "_createdAt": "2026-08-12T09:32:16Z",
    "_id": "image-21c2e1a00a8ea0f0248920ebd4e93f9c3a80b075-1944x1460-png",
    "_rev": "DYQzwRbvxyR3ukdwtHctLW",
    "_type": "sanity.imageAsset",
    "_updatedAt": "2026-08-12T09:32:16Z",
    "assetId": "21c2e1a00a8ea0f0248920ebd4e93f9c3a80b075",
    "extension": "png",
    "metadata": {
      "_type": "sanity.imageMetadata",
      "blurHash": "V02r:V?b-qx^RPpKROWBg4V?O[M{aet8oLXTV?j[o#j[",
      "dimensions": {
        "_type": "sanity.imageDimensions",
        "aspectRatio": 1.3315068493150686,
        "height": 1460,
        "width": 1944
      },
      "hasAlpha": true,
      "isOpaque": false,
      "lqip": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAABrUlEQVR4nKWU2W7bMBRE9dwmcrRx30RqtRUr//9pRa0pSMNL4qIw0ocDLYAOZy4lZaVft7f2iJ17R24PeNEzfsjpgRc9YecWFOEDuV/xahfkZsGrOeCnmiNbbg+/s1r2oGYCczOIHlHygDfqsKMuHW+0KHhAbWbUYQXxR7D2AGZnNKpHKQIqNWwZ4S2kGaDdBK56NLxFRSwqYhJlo69U1KaHSTiCdiu4P0C6CUL3IMKjEQEZ4f5O2IGKACp84iy/k8ZFWItK9aj1iNiOCI8YqmYONfd3QjumY1xNqC7BhEdN7aeUZWOS+Epzux8Xy2KimM75fcK4GVL34DIkYcPcQ/W/Yy5CD2UGGDcl4vklHeXfFGo7wrV72HZOtWO6OIqafK37hJDJkKoOw4puXKHseB7yw+yeTShDqurDgrZbwHX/ZMV/CJUdU924OXEE/yVkMpxn6PfXdzFWfn4z9BehuCTcQ9sJXHag3xJqVMxtGdPDpuIOhwXK7UFkh5K6REEtCnLj84v8mLBm7pQR/35i3brx7iN98IWesZNDIr8jXsefQxWTP7JVzJ1q4X/9AUMviC8r+hPBAAAAAElFTkSuQmCC",
      "palette": {
        "_type": "sanity.imagePalette",
        "darkMuted": {
          "_type": "sanity.imagePaletteSwatch",
          "background": "#274253",
          "foreground": "#fff",
          "population": 0.15,
          "title": "#fff"
        },
        "darkVibrant": {
          "_type": "sanity.imagePaletteSwatch",
          "background": "#061c34",
          "foreground": "#fff",
          "population": 0.03,
          "title": "#fff"
        },
        "dominant": {
          "_type": "sanity.imagePaletteSwatch",
          "background": "#274253",
          "foreground": "#fff",
          "population": 0.15,
          "title": "#fff"
        },
        "lightMuted": {
          "_type": "sanity.imagePaletteSwatch",
          "background": "#90929b",
          "foreground": "#fff",
          "population": 0.06,
          "title": "#fff"
        },
        "lightVibrant": {
          "_type": "sanity.imagePaletteSwatch",
          "background": "#a5c1d3",
          "foreground": "#000",
          "population": 0,
          "title": "#fff"
        },
        "muted": {
          "_type": "sanity.imagePaletteSwatch",
          "background": "#5e7e8f",
          "foreground": "#fff",
          "population": 0.05,
          "title": "#fff"
        },
        "vibrant": {
          "_type": "sanity.imagePaletteSwatch",
          "background": "#34566c",
          "foreground": "#fff",
          "population": 0.01,
          "title": "#fff"
        }
      },
      "thumbHash": "h/eBBIAP31pah1mHdkgJh5RwcICICAiIAA=="
    },
    "mimeType": "image/png",
    "originalFilename": "regoEditor.png",
    "path": "images/rafvlnhi/production/21c2e1a00a8ea0f0248920ebd4e93f9c3a80b075-1944x1460.png",
    "sha1hash": "21c2e1a00a8ea0f0248920ebd4e93f9c3a80b075",
    "size": 192522,
    "uploadId": "f5a24ff946d4edaaff3648830c918a41c2879013",
    "url": "https://cdn.sanity.io/images/rafvlnhi/production/21c2e1a00a8ea0f0248920ebd4e93f9c3a80b075-1944x1460.png"
  },
  "link": {
    "_type": "link",
    "href": null,
    "openInNewTab": false
  },
  "markDefs": null
}
```
