Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Post History

66%
+2 −0
Q&A Sorting by score after excluding a tag gave me a 500 error

First, to quote from the 500 page: It's not your fault. Thanks for raising this. Instant workaround For your particular combination of filters and sorting criterion, here is a corrected lin...

posted 1y ago by trichoplax‭  ·  edited 1y ago by trichoplax‭

Answer
#3: Post edited by user avatar trichoplax‭ · 2023-05-23T19:37:31Z (over 1 year ago)
Fix to the awkward workaround advice thanks to Monica
  • First, to quote from the 500 page:
  • > It's not your fault.
  • Thanks for raising this.
  • ## Instant workaround
  • For your particular combination of filters and sorting criterion, here is a corrected link that you can use until the bug is fixed:
  • - [Site Proposals excluding tag status-launched sorted by score]
  • Once you are on that page, you can bookmark it if you wish, to avoid the need to keep coming back to this answer. Bear in mind that the bookmark (and this link) may stop working once the bug is fixed.
  • ## What works and what doesn't
  • Sorting by any criterion works fine with any filters apart from the tags filters. You don't need to avoid filters in general.
  • If any tags are included and/or excluded in the filter, then sorting by any criterion will fail with the 500 message mentioned. This affects all categories for all communities.
  • ## Awkward workaround
  • For combinations of filters and sorting criteria other than the one in the "Instant workaround" section above, you can construct your own workaround link if you wish ***(only necessary if your filters include tags)***:
  • 1. Apply all of the filters you want
  • 2. Instead of pressing a sort button, paste the appropriate sort string onto the end of the URL in the address bar on that filtered page
  • - To sort by "Age", use `?sort=age`
  • - To sort by "Score", use `?sort=score`
  • - To sort by "Random", use `?sort=lottery`
  • 3. Press Enter on your keyboard and the page will display correctly filtered and sorted
  • 4. At this point you can bookmark the page or copy the URL from the address bar to share it as a link
  • Note that this is likely to stop working once the bug is fixed, so if you bookmark or share a particular sorted filtered list using this workaround, you may need to update it later.
  • ## Root cause *(you don't need to read this section unless you're fixing the bug or curious)*
  • There is a bug in the URL, which prevents the server from understanding it.
  • *The behaviour for included and excluded tags is similar, as is the behaviour for 1 or multiple tags, so for brevity only multiple excluded tags are covered here.*
  • ### Multiple tags excluded
  • The URL before sorting:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985
  • ```
  • This ends in `&exclude_tags[]=984&exclude_tags[]=985`.
  • The (broken) URL after sorting:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags=[%22984%22,%20%22985%22]&sort=score
  • ```
  • This ends in `&exclude_tags=["984", "985"]&sort=score`.
  • The workaround URL:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985&sort=score
  • ```
  • This ends in `&exclude_tags[]=984&exclude_tags[]=985&sort=score`.
  • ### Potential fixes
  • The broken version uses a single parameter `&exclude_tags` followed by a comma separated list of tag ids in double quotes, whereas the working version uses a separate `&exclude_tags` parameter per excluded tag. This suggests one of the following approaches to fixing the bug:
  • - Make clicking on a sorting button link to a URL using a separate `&exclude_tags` parameter per excluded tag (matching the workaround provided above)
  • - Use a single `&exclude_tags` parameter everywhere (before and after sorting) and fix the code to be able to understand this
  • The first approach will probably be quicker to implement, but the second approach will avoid excessively long URLs, and I suspect was probably the original intention.
  • [Site Proposals excluding tag status-launched sorted by score]: https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&sort=score "Site Proposals without status-launched sorted by score"
  • First, to quote from the 500 page:
  • > It's not your fault.
  • Thanks for raising this.
  • ## Instant workaround
  • For your particular combination of filters and sorting criterion, here is a corrected link that you can use until the bug is fixed:
  • - [Site Proposals excluding tag status-launched sorted by score]
  • Once you are on that page, you can bookmark it if you wish, to avoid the need to keep coming back to this answer. Bear in mind that the bookmark (and this link) may stop working once the bug is fixed.
  • ## What works and what doesn't
  • Sorting by any criterion works fine with any filters apart from the tags filters. You don't need to avoid filters in general.
  • If any tags are included and/or excluded in the filter, then sorting by any criterion will fail with the 500 message mentioned. This affects all categories for all communities.
  • ## Awkward workaround
  • For combinations of filters and sorting criteria other than the one in the "Instant workaround" section above, you can construct your own workaround link if you wish ***(only necessary if your filters include tags)***:
  • 1. Apply all of the filters you want
  • 2. Instead of pressing a sort button, paste the appropriate sort string onto the end of the URL in the address bar on that filtered page
  • - To sort by "Age", use `&sort=age`
  • - To sort by "Score", use `&sort=score`
  • - To sort by "Random", use `&sort=lottery`
  • 3. Press Enter on your keyboard and the page will display correctly filtered and sorted
  • 4. At this point you can bookmark the page or copy the URL from the address bar to share it as a link
  • Note that this is likely to stop working once the bug is fixed, so if you bookmark or share a particular sorted filtered list using this workaround, you may need to update it later.
  • ## Root cause *(you don't need to read this section unless you're fixing the bug or curious)*
  • There is a bug in the URL, which prevents the server from understanding it.
  • *The behaviour for included and excluded tags is similar, as is the behaviour for 1 or multiple tags, so for brevity only multiple excluded tags are covered here.*
  • ### Multiple tags excluded
  • The URL before sorting:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985
  • ```
  • This ends in `&exclude_tags[]=984&exclude_tags[]=985`.
  • The (broken) URL after sorting:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags=[%22984%22,%20%22985%22]&sort=score
  • ```
  • This ends in `&exclude_tags=["984", "985"]&sort=score`.
  • The workaround URL:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985&sort=score
  • ```
  • This ends in `&exclude_tags[]=984&exclude_tags[]=985&sort=score`.
  • ### Potential fixes
  • The broken version uses a single parameter `&exclude_tags` followed by a comma separated list of tag ids in double quotes, whereas the working version uses a separate `&exclude_tags` parameter per excluded tag. This suggests one of the following approaches to fixing the bug:
  • - Make clicking on a sorting button link to a URL using a separate `&exclude_tags` parameter per excluded tag (matching the workaround provided above)
  • - Use a single `&exclude_tags` parameter everywhere (before and after sorting) and fix the code to be able to understand this
  • The first approach will probably be quicker to implement, but the second approach will avoid excessively long URLs, and I suspect was probably the original intention.
  • [Site Proposals excluding tag status-launched sorted by score]: https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&sort=score "Site Proposals without status-launched sorted by score"
#2: Post edited by user avatar trichoplax‭ · 2023-05-23T19:32:24Z (over 1 year ago)
Slight clarification of root cause section
  • First, to quote from the 500 page:
  • > It's not your fault.
  • Thanks for raising this.
  • ## Instant workaround
  • For your particular combination of filters and sorting criterion, here is a corrected link that you can use until the bug is fixed:
  • - [Site Proposals excluding tag status-launched sorted by score]
  • Once you are on that page, you can bookmark it if you wish, to avoid the need to keep coming back to this answer. Bear in mind that the bookmark (and this link) may stop working once the bug is fixed.
  • ## What works and what doesn't
  • Sorting by any criterion works fine with any filters apart from the tags filters. You don't need to avoid filters in general.
  • If any tags are included and/or excluded in the filter, then sorting by any criterion will fail with the 500 message mentioned. This affects all categories for all communities.
  • ## Awkward workaround
  • For combinations of filters and sorting criteria other than the one in the "Instant workaround" section above, you can construct your own workaround link if you wish ***(only necessary if your filters include tags)***:
  • 1. Apply all of the filters you want
  • 2. Instead of pressing a sort button, paste the appropriate sort string onto the end of the URL in the address bar on that filtered page
  • - To sort by "Age", use `?sort=age`
  • - To sort by "Score", use `?sort=score`
  • - To sort by "Random", use `?sort=lottery`
  • 3. Press Enter on your keyboard and the page will display correctly filtered and sorted
  • 4. At this point you can bookmark the page or copy the URL from the address bar to share it as a link
  • Note that this is likely to stop working once the bug is fixed, so if you bookmark or share a particular sorted filtered list using this workaround, you may need to update it later.
  • ## Root cause *(you don't need to read this section unless you're fixing the bug or curious)*
  • There is a bug in the URL, which prevents the server from understanding it.
  • *The behaviour for included and excluded tags is similar, as is the behaviour for 1 or multiple tags, so for brevity only multiple excluded tags are covered here.*
  • ### Multiple tags excluded
  • The URL before sorting:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985
  • ```
  • This ends in `&exclude_tags[]=984&exclude_tags[]=985`.
  • The (broken) URL after sorting:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags=[%22984%22,%20%22985%22]&sort=score
  • ```
  • This ends in `&exclude_tags=["984", "985"]&sort=score`.
  • The workaround URL:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985&sort=score
  • ```
  • This ends in `&exclude_tags[]=984&exclude_tags[]=985&sort=score`.
  • ### Potential fixes
  • The broken version uses a single parameter `&exclude_tags` followed by a comma separated list of tag ids in double quotes, whereas the working version uses a separate `&exclude_tags` parameter per excluded tag. This suggests one of the following approaches to fixing the bug:
  • - Make clicking on a sorting button link to a URL using a separate `&exclude_tags` parameter per excluded tag (matching the workaround provided above)
  • - Use a single `&exclude_tags` parameter everywhere (before and after sorting)
  • The first approach will probably be quicker to implement, but the second approach will avoid excessively long URLs.
  • [Site Proposals excluding tag status-launched sorted by score]: https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&sort=score "Site Proposals without status-launched sorted by score"
  • First, to quote from the 500 page:
  • > It's not your fault.
  • Thanks for raising this.
  • ## Instant workaround
  • For your particular combination of filters and sorting criterion, here is a corrected link that you can use until the bug is fixed:
  • - [Site Proposals excluding tag status-launched sorted by score]
  • Once you are on that page, you can bookmark it if you wish, to avoid the need to keep coming back to this answer. Bear in mind that the bookmark (and this link) may stop working once the bug is fixed.
  • ## What works and what doesn't
  • Sorting by any criterion works fine with any filters apart from the tags filters. You don't need to avoid filters in general.
  • If any tags are included and/or excluded in the filter, then sorting by any criterion will fail with the 500 message mentioned. This affects all categories for all communities.
  • ## Awkward workaround
  • For combinations of filters and sorting criteria other than the one in the "Instant workaround" section above, you can construct your own workaround link if you wish ***(only necessary if your filters include tags)***:
  • 1. Apply all of the filters you want
  • 2. Instead of pressing a sort button, paste the appropriate sort string onto the end of the URL in the address bar on that filtered page
  • - To sort by "Age", use `?sort=age`
  • - To sort by "Score", use `?sort=score`
  • - To sort by "Random", use `?sort=lottery`
  • 3. Press Enter on your keyboard and the page will display correctly filtered and sorted
  • 4. At this point you can bookmark the page or copy the URL from the address bar to share it as a link
  • Note that this is likely to stop working once the bug is fixed, so if you bookmark or share a particular sorted filtered list using this workaround, you may need to update it later.
  • ## Root cause *(you don't need to read this section unless you're fixing the bug or curious)*
  • There is a bug in the URL, which prevents the server from understanding it.
  • *The behaviour for included and excluded tags is similar, as is the behaviour for 1 or multiple tags, so for brevity only multiple excluded tags are covered here.*
  • ### Multiple tags excluded
  • The URL before sorting:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985
  • ```
  • This ends in `&exclude_tags[]=984&exclude_tags[]=985`.
  • The (broken) URL after sorting:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags=[%22984%22,%20%22985%22]&sort=score
  • ```
  • This ends in `&exclude_tags=["984", "985"]&sort=score`.
  • The workaround URL:
  • ```text
  • https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985&sort=score
  • ```
  • This ends in `&exclude_tags[]=984&exclude_tags[]=985&sort=score`.
  • ### Potential fixes
  • The broken version uses a single parameter `&exclude_tags` followed by a comma separated list of tag ids in double quotes, whereas the working version uses a separate `&exclude_tags` parameter per excluded tag. This suggests one of the following approaches to fixing the bug:
  • - Make clicking on a sorting button link to a URL using a separate `&exclude_tags` parameter per excluded tag (matching the workaround provided above)
  • - Use a single `&exclude_tags` parameter everywhere (before and after sorting) and fix the code to be able to understand this
  • The first approach will probably be quicker to implement, but the second approach will avoid excessively long URLs, and I suspect was probably the original intention.
  • [Site Proposals excluding tag status-launched sorted by score]: https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&sort=score "Site Proposals without status-launched sorted by score"
#1: Initial revision by user avatar trichoplax‭ · 2023-05-23T19:23:49Z (over 1 year ago)
First, to quote from the 500 page:

> It's not your fault.

Thanks for raising this.

## Instant workaround
For your particular combination of filters and sorting criterion, here is a corrected link that you can use until the bug is fixed:
- [Site Proposals excluding tag status-launched sorted by score]

Once you are on that page, you can bookmark it if you wish, to avoid the need to keep coming back to this answer. Bear in mind that the bookmark (and this link) may stop working once the bug is fixed.

## What works and what doesn't
Sorting by any criterion works fine with any filters apart from the tags filters. You don't need to avoid filters in general.

If any tags are included and/or excluded in the filter, then sorting by any criterion will fail with the 500 message mentioned. This affects all categories for all communities.

## Awkward workaround
For combinations of filters and sorting criteria other than the one in the "Instant workaround" section above, you can construct your own workaround link if you wish ***(only necessary if your filters include tags)***:

1. Apply all of the filters you want
2. Instead of pressing a sort button, paste the appropriate sort string onto the end of the URL in the address bar on that filtered page
    - To sort by "Age", use `?sort=age`
    - To sort by "Score", use `?sort=score`
    - To sort by "Random", use `?sort=lottery`
3. Press Enter on your keyboard and the page will display correctly filtered and sorted
4. At this point you can bookmark the page or copy the URL from the address bar to share it as a link

Note that this is likely to stop working once the bug is fixed, so if you bookmark or share a particular sorted filtered list using this workaround, you may need to update it later.

## Root cause *(you don't need to read this section unless you're fixing the bug or curious)*
There is a bug in the URL, which prevents the server from understanding it.

*The behaviour for included and excluded tags is similar, as is the behaviour for 1 or multiple tags, so for brevity only multiple excluded tags are covered here.*

### Multiple tags excluded
The URL before sorting:

```text
https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985
```

This ends in `&exclude_tags[]=984&exclude_tags[]=985`.

The (broken) URL after sorting:

```text
https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags=[%22984%22,%20%22985%22]&sort=score
```

This ends in `&exclude_tags=["984", "985"]&sort=score`.

The workaround URL:

```text
https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985&sort=score
```

This ends in `&exclude_tags[]=984&exclude_tags[]=985&sort=score`.

### Potential fixes
The broken version uses a single parameter `&exclude_tags` followed by a comma separated list of tag ids in double quotes, whereas the working version uses a separate `&exclude_tags` parameter per excluded tag. This suggests one of the following approaches to fixing the bug:
- Make clicking on a sorting button link to a URL using a separate `&exclude_tags` parameter per excluded tag (matching the workaround provided above)
- Use a single `&exclude_tags` parameter everywhere (before and after sorting)

The first approach will probably be quicker to implement, but the second approach will avoid excessively long URLs.


[Site Proposals excluding tag status-launched sorted by score]: https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&sort=score "Site Proposals without status-launched sorted by score"