# Flag to Ignore Unknown Predicate Errors in s(CASP) isn't working

**URL:** <https://swi-prolog.discourse.group/t/flag-to-ignore-unknown-predicate-errors-in-s-casp-isnt-working/5460>\
**Category:** Help!\
**Tags:** scasp\
**Created:** [June 3, 2022, 11:15pm UTC](https://swi-prolog.discourse.group/t/flag-to-ignore-unknown-predicate-errors-in-s-casp-isnt-working/5460 "2022-06-03T23:15:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JasonMorris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jasonmorris/32/3824_2.png) [@JasonMorris](https://swi-prolog.discourse.group/u/JasonMorris)\
**Post date:** [June 3, 2022, 11:15pm UTC](https://swi-prolog.discourse.group/t/flag-to-ignore-unknown-predicate-errors-in-s-casp-isnt-working/5460/1 "2022-06-03T23:15:18Z")

</div>

In [Is it possible to suppress warnings in SWISH? - #3 by JasonMorris](https://swi-prolog.discourse.group/t/is-it-possible-to-suppress-warnings-in-swish/4623/3) I asked for a way to avoid problems with scasp\_predicate … does not exist" errors, and @jan hooked me up with the

```prolog
:- set_prolog_flag(scasp_unknown, fail).

```

But I have code that is still throwing that error, when it calls `scasp/2` against a predicate that hasn’t been defined anywhere in the code. I’ve tried making it dynamic, to no avail, which makes sense, because my system is compiling code to a file, and then consulting it. Nothing is being asserted.

What I think is the same problem can be seen by opening an empty s(CASP) program in SWISH and running the query `? a(X).`

```prolog
scasp_predicate `'04c200ae-e39a-4b04-a78f-0f90a0e09694:a'/1' does not exist

```

I want to be able to specify that for certain predicates, their non-existence should make them fail instead of throwing an error when used as the first parameter to `scasp/2.` How can I do that?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [June 5, 2022, 2:39pm UTC](https://swi-prolog.discourse.group/t/flag-to-ignore-unknown-predicate-errors-in-s-casp-isnt-working/5460/2 "2022-06-05T14:39:58Z")

</div>

As is, s(CASP) raises an error if the predicate immediately called by scasp/2 is undefined and the flag only takes care of indirectly called predicates. The rationale is that it makes very little sense to call an already undefined predicate. I agree it is also somewhat inconsistent. If you have some wrapper around anyway, you can use clause/2 or predicate\_property/2 to check the predicate is undefined and simply fail.

---

<div class="post-metadata">

**Author:** ![JasonMorris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jasonmorris/32/3824_2.png) [@JasonMorris](https://swi-prolog.discourse.group/u/JasonMorris)\
**Post date:** [June 6, 2022, 6:08pm UTC](https://swi-prolog.discourse.group/t/flag-to-ignore-unknown-predicate-errors-in-s-casp-isnt-working/5460/3 "2022-06-06T18:08:17Z")

</div>

That makes sense. My use-pattern is atypical, and probably not long for this world, anyway. I was able to solve the problem in the short term by handling the error differently in Python. Thanks!
